Skip to content

[SPIR-V] CStyleCastExpr error when casting to void #7134

@noahwhygodwhy

Description

@noahwhygodwhy

Description

I'd like to first acknowledge that this is a bit silly, but when casting a variable to a (void), a much more internal-compiler sort of error is returned when compiled to spir-v. No error occurs when compiling to dxil. This happens with every type I've tried (uint, float, bool, struct, RWByteAddressBuffer)

(The reason for doing this (void) nonsense is selectively silencing unused-variable warnings in a rather large code base in cases where keeping the sometimes-unused variables is unavoidable. Also, it's in a #define so pragmas to silence the warning don't work.)

Steps to Reproduce

https://godbolt.org/z/6bd1jThrx

Actual Behavior

CStyleCastExpr 0x5e206b49aae0 'void' <ToVoid>
`-DeclRefExpr 0x5e206b49aaa8 'bool' lvalue Var 0x5e206b49a450 'x' 'bool'

Compiler returned: 5

Environment

  • DXC version: 1.8.2407 and trunk
  • Host Operating System: Windows 11 22h2 (22621.4751) and also godbolt

This might be related to #5103, as it is the only issue that contains CStyleCastExpr when i searched, but that seemed to be an issue with the dxil side, while this error only happens when outputting spir-v

Metadata

Metadata

Assignees

Labels

bugBug, regression, crashspirvWork related to SPIR-V

Type

No type

Projects

Status

Done

Status

Triaged

Relationships

None yet

Development

No branches or pull requests

Issue actions