Skip to content

[SPIR-V] Assertion failed when assigning non-bool type variable to bool type variable with ternary operator #6798

Closed

Description

@shobomaru

Description
LLVM assertion failed.
(Debug build only?)

Steps to Reproduce
dxc -T ps_6_0 -spirv path/to/file.hlsl

HLSL code:

void main(float a : A)
{
	bool bar = (a > 0) ? 1 : 0;
}

also crashes: bool bar = (a > 0) ? 1.0 : 0.0;

If change the code in one of the following ways, the issue is not occurred.

  • Make a constant
  • Change operand 2 or 3 to bool type value (e.g. bool bar = (a > 0) ? 1 : false; )

Actual Behavior

Assertion failed: (!isLitTypeOrVecOfLitType(resultType)), function visit, file LiteralTypeVisitor.cpp, line 314.

Environment

  • DXC version: libdxcompiler.dylib: 1.8(dev;4661-a54abe84)
  • Host Operating System: Windows 11 23H2 and macOS 14.5

Activity

  1. added
    bug
    needs-triage
    spirv
    on Jul 17, 2024
  2. damyanp commented on Jul 18, 2024

    @damyanp
    Member

    LiteralTypeVisitor.cpp is a SPIRV only file.

  3. damyanp commented on Jul 18, 2024

    @damyanp
    Member

    note: since HLSL202x doesn't use literal types, this is extremely unlikely to repro under -HV 202x.

  4. s-perron commented on Aug 22, 2024

    @s-perron
    Collaborator

    Looking at the code, I believe the assert is simply incorrect. I will remove it.

  5. moved this from For Google to Triaged in HLSL Triageon Aug 22, 2024
  6. added a commit that references this issue on Aug 22, 2024
    79569a9
  7. added a commit that references this issue on Aug 23, 2024
    9c6b2c1
  8. added a commit that references this issue on Jul 24, 2025
    e06812f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugspirv

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions