Skip to content

Windows: a generic call's result passed to a consuming parameter is dropped the wrong number of times (da_generic_call_results) #2723

Closed

Description

@ehartford

On Windows x86_64, test/debug_alloc/da_generic_call_results.w fails its own drop count, while it passes on macOS and Linux:

> with-stage1.exe run --debug-alloc test/debug_alloc/da_generic_call_results.w
panic at test/debug_alloc/da_generic_call_results.w:27:5: assertion failed

Line 27 is assert(result_drops == 6), right after

fn identity[T](value: T): value
fn accept(value: ResultGuard): assert(value.text == "owned")
...
    accept(identity(ResultGuard { text: "owned" }))

So the generic call's result, passed straight into a consuming parameter, is dropped a different number of times on Windows than elsewhere (ResultGuard is a str plus a Drop, 16+ bytes: on Win64 it is passed by reference to a caller copy, where SysV passes it in registers). The first three asserts (a discarded generic result, a discarded method result, the loop) pass.

Found while removing the debug-alloc lane's Windows skip (#807); stage1 of main c5fdc17 on win10. Route: the debug allocator with WITH_DEBUG_ALLOC_TRAP_FREE and cdb on win10, and --dump-drop-plan / --dump-abi for exercise under --target=windows_x86_64.

Activity

  1. ehartford commented on Oct 26, 2026

    @ehartford
    ContributorAuthor

    Fixed on main by 013ba52 (stack #2743, battery GREEN on its top ddb68e8: behavior-tests 1949/1949, gate, uat and battery-checks green).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions