Skip to content

When using "--variable" as an argument to an inout function, 2 is subtracted not one #4871

Description

@AdamJMiles

https://godbolt.org/z/73so7qzzW

void Func(inout uint byteOffset) { }

uint PSMain(uint i : I) : SV_TARGET { Func(--i); // Subtracts 2... return i; }

The resulting DXIL has an "Add minus two" operation, not "add minus one".

%2 = add i32 %1, -2, !dbg !37

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug, regression, crash

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Triaged

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions