Skip to content

[HLSL] empty cbuffer crashes clang codegen #106596

Closed as duplicate of#113514
Closed as duplicate of#113514
@damyanp

Description

@damyanp

https://godbolt.org/z/7MeqP9vMG

cbuffer F { };
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-trunk/bin/clang --driver-mode=dxc -Zi -Qembed_debug -Fc /app/output.s -fcolor-diagnostics -fno-crash-diagnostics -T lib_6_3 <source>
1.	<eof> parser at end of file
2.	Per-file LLVM IR generation
 #0 0x0000000003893d58 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3893d58)
 #1 0x0000000003891ec4 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3891ec4)
 #2 0x00000000037dc5d8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x0000794fdf642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x0000000003290610 llvm::PointerType::get(llvm::Type*, unsigned int) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3290610)
 #5 0x00000000031d1381 llvm::GlobalVariable::GlobalVariable(llvm::Type*, bool, llvm::GlobalValue::LinkageTypes, llvm::Constant*, llvm::Twine const&, llvm::GlobalValue::ThreadLocalMode, unsigned int, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x31d1381)
 #6 0x0000000004057dae clang::CodeGen::CGHLSLRuntime::finishCodeGen() (/opt/compiler-explorer/clang-trunk/bin/clang+0x4057dae)
 #7 0x0000000003cb2c8c clang::CodeGen::CodeGenModule::Release() (/opt/compiler-explorer/clang-trunk/bin/clang+0x3cb2c8c)
 #8 0x000000000416db8e (anonymous namespace)::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext&) ModuleBuilder.cpp:0:0
 #9 0x000000000416b895 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x416b895)
#10 0x000000000611fa0c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x611fa0c)

Found while looking for repro to microsoft/DirectXShaderCompiler#4514

Metadata

Metadata

Assignees

Labels

HLSLHLSL Language Supportclang:codegenIR generation bugs: mangling, exceptions, etc.crashPrefer [crash-on-valid] or [crash-on-invalid]duplicateResolved as duplicate

Type

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions