Skip to content

ICE when interface implementation contains unsized array field #10420

@jvepsalainen-nv

Description

@jvepsalainen-nv

Issue Description

When a struct implementing an interface contains an unsized array field (float data[]), the compiler crashes with "Unimplemented type packing" (error 99999). Unsized arrays have indeterminate size and cannot fit in the fixed-size AnyValue byte buffer, so this should be rejected with error 41014 like other unsupported types.

Reproducer Code

interface IFoo { int get(); }
export struct Impl : IFoo {
    float data[];
    int get() { return int(data[0]); }
}
export struct GoodImpl : IFoo {
    float v;
    int get() { return int(v); }
}
RWStructuredBuffer<int> out;
[numthreads(1,1,1)]
void computeMain() {
    IFoo f = createDynamicObject<IFoo>(0, 0);
    out[0] = f.get();
}

Command:

slangc -target spirv test.slang

Expected Behavior

Error 41014: "type 'Impl' contains fields that cannot be packed into ordinary bytes for dynamic dispatch."

Actual Behavior

error[E99999]: Slang compilation aborted due to an exception of N5Slang13InternalErrorE unimplemented: Unimplemented type packing

Test to Enable

When fixed, enable the DISABLED test tests/language-feature/dynamic-dispatch/diagnose-unsized-array-in-impl.slang.

Metadata

Metadata

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions