-
Notifications
You must be signed in to change notification settings - Fork 803
Open
Labels
Description
Description
When using HLSL 202x, a warning can be enabled to find every place where a signed literal is now unsigned.
This warning is enabled with -Whlsl-legacy-literal.
It allows going over all the potentially problematic cases in the code.
However, if the programmer explicitly handles the "signedness" of the literal by using the u suffix or by casting the literal to a specific type, the warning shouldn't trigger. Currently it does trigger in those cases and the warning can't be easily silenced.
Steps to Reproduce
All of the following will trigger the warning
static const uint A = 0xFFF00000u;
static const uint B = (uint)0xFFF00000;
static const int C = (int)0xFFF00000;
To reproduce, make sure to include the following arguments: -HV 202x -WX -Whlsl-legacy-literal
Actual Behavior
error: literal value is treated as signed in HLSL 2021 and earlier, and unsigned in later language versions [-Werror,-Whlsl-legacy-literal]
Environment
- DXC version: v1.8.2505.1
- Host Operating System: Windows 11 24H2
@llvm-beanz asked me to tag him on this bug report.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
No status