Skip to content

Crash when parsing a shader with a bitfield #1693

Description

DXC currently (tested using bc9ad94) crashes when parsing a shader with a bitfield.
While I don't expect bitfields to actually be currently supported, the compiler should not crash.

// dxc (bc9ad948) /T cs_6_0 shader.hlsl
struct Foo
{
	uint a : 1;
	uint b : 31;
};

//ConstantBuffer<Foo> Input;
StructuredBuffer<Foo> Input;
RWBuffer<uint> Output;

[numthreads(1,1,1)]
void main()
{
	Output[0] = Input[0].a;
}

Crash call tack:

[0x0]   VCRUNTIME140D!MoveSmall + 0x6b   
[0x1]   dxcompiler!std::char_traits<char>::move + 0x3c   
[0x2]   dxcompiler!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::assign + 0x78   
[0x3]   dxcompiler!std::basic_string<char,std::char_traits<char>,std::allocator<char> >::operator= + 0x8a   
[0x4]   dxcompiler!hlsl::DxilFieldAnnotation::SetFieldName + 0x39   
[0x5]   dxcompiler!`anonymous namespace'::CGMSHLSLRuntime::ConstructStructAnnotation + 0x73b   
[0x6]   dxcompiler!`anonymous namespace'::CGMSHLSLRuntime::AddTypeAnnotation + 0x372   
[0x7]   dxcompiler!`anonymous namespace'::CGMSHLSLRuntime::ConstructStructAnnotation + 0x646   
[0x8]   dxcompiler!`anonymous namespace'::CGMSHLSLRuntime::AddTypeAnnotation + 0x465   
[0x9]   dxcompiler!`anonymous namespace'::CGMSHLSLRuntime::SetUAVSRV + 0x1c7   
[0xa]   dxcompiler!`anonymous namespace'::CGMSHLSLRuntime::AddUAVSRV + 0x548   
[0xb]   dxcompiler!`anonymous namespace'::CGMSHLSLRuntime::addResource + 0x24a   
[0xc]   dxcompiler!clang::CodeGen::CodeGenModule::EmitTopLevelDecl + 0x1a8   
[0xd]   dxcompiler!`anonymous namespace'::CodeGeneratorImpl::HandleTopLevelDecl + 0xb5   
[0xe]   dxcompiler!clang::BackendConsumer::HandleTopLevelDecl + 0xf8   
[0xf]   dxcompiler!clang::ParseAST + 0x284   
[0x10]   dxcompiler!clang::ASTFrontendAction::ExecuteAction + 0x12b   
[0x11]   dxcompiler!clang::CodeGenAction::ExecuteAction + 0x69d   
[0x12]   dxcompiler!clang::FrontendAction::Execute + 0x8c   
[0x13]   dxcompiler!DxcCompiler::CompileWithDebug + 0x1475   
[0x14]   dxcompiler!DxcCompiler::Compile + 0xc7   
[0x15]   dxc!DxcContext::Compile + 0xcd3   

Activity

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

Metadata

Metadata

Labels

bugBug, regression, crash

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions