Skip to content

Use of "float1" can cause assert/missing switch case #6861

Open

Description

@jeffnn

Description
Compiling the below code hits an assert (a missing case in SemaHLSL.cpp's FlattenedTypeIterator::pushTrackerForType).
"objectKind" is ArTypeObjectKind::AR_TOBJ_POINTER, which is missing from the switch.

Steps to Reproduce
dxc -Tcs_6_6

ByteAddressBuffer inBuffer : register(t0);
RWByteAddressBuffer bufferArray[] : register(u0);

[numthreads(1, 1, 1)]
void main()
{
  // Simple read
  float1 dynamicBufferIndex = inBuffer.Load(0);

  // Dynamically indexed write
  bufferArray[dynamicBufferIndex].Store(0, 1));
}

Actual Behavior
Assert in debug.

Environment

  • dxcompiler.dll: 1.8 - 1.8.0.4583 (PIX_MemberFunctions, 2f4a01a-dirty)
  • Win11, recent insider build

Activity

  1. added
    bug
    needs-triage
    on Aug 14, 2024
  2. damyanp commented on Aug 14, 2024

    @damyanp
    Member

    Thanks Jeff. Do you have any additional information that may help us prioritize this?

  3. jeffnn commented on Aug 14, 2024

    @jeffnn
    ContributorAuthor

    Welp, I had two reports from PIX users. They were both apparently a different issue, wherein the 2212 compiler emitted a dbg.declare that the current compiler flagged as containing a bad bit-piece (an assert fired that the bit-piece was covering the entire variable). I hit the current issue while attempting to repro the bit-piece issue on the current compiler, which I could not.
    So... I guess it's not huge?
    I also note that it's quite easy to tweak this repro so that nothing bad happens.
    I guess I'll tell the pix users to upgrade their compiler and/or make a whitespace edit in PIX so that the new compiler is used.

  4. damyanp commented on Aug 15, 2024

    @damyanp
    Member

    Jeff Noyle (@jeffnn) - we're marking this as dormant since there are several easy workarounds for this. We've not been able to reproduce the assert though, but we get a compile error about being unable to find an overload for the array access operator.

    Gregory Roth (@pow2clk) is trying to repro this to get a sense of whether or not it is a recent regression.

  5. pow2clk commented on Aug 15, 2024

    @pow2clk
    Collaborator

    I synced the latest code and ran with asserts enabled and I didn't get any asserts here.

  6. jeffnn commented on Aug 15, 2024

    @jeffnn
    ContributorAuthor

    Huh. Top of tree debug build:

    D:\DirectXShaderCompiler>copy con test.hlsl
    ByteAddressBuffer inBuffer : register(t0);
    RWByteAddressBuffer bufferArray[] : register(u0);

    [numthreads(1, 1, 1)]
    void main()
    {
    // Simple read
    float1 dynamicBufferIndex = inBuffer.Load(0);

    // Dynamically indexed write
    bufferArray[dynamicBufferIndex].Store(0, 1));
    }
    ^Z
    1 file(s) copied.

    D:\DirectXShaderCompiler>d:\hlsl.bin\Debug\bin\dxc.exe -Tcs_6_6 test.hlsl
    Internal compiler error: Terminal Error 0x80000003

  7. damyanp commented on Aug 15, 2024

    @damyanp
    Member

    Godbolt link: https://godbolt.org/z/fY6P53Yfa

    <source>:11:14: error: no viable overloaded operator[] for type 'RWByteAddressBuffer []'
      bufferArray[dynamicBufferIndex].Store(0, 1);
      ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
    

    Note that the "Store" line has an extra ) at the end of it. Godbolt generates the same error regardless though.

  8. jeffnn commented on Aug 15, 2024

    @jeffnn
    ContributorAuthor

    Ach, yes, that ) is a typo on my part. I get the same error with it removed, though:
    D:\DirectXShaderCompiler>type test.hlsl
    ByteAddressBuffer inBuffer : register(t0);
    RWByteAddressBuffer bufferArray[] : register(u0);

    [numthreads(1, 1, 1)]
    void main()
    {
    // Simple read
    float1 dynamicBufferIndex = inBuffer.Load(0);

    // Dynamically indexed write
    bufferArray[dynamicBufferIndex].Store(0, 1);
    }

    D:\DirectXShaderCompiler>d:\hlsl.bin\Debug\bin\dxc.exe -Tcs_6_6 test.hlsl
    Internal compiler error: Terminal Error 0x80000003

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions