Skip to content

DXC crashes when building some shaders #1684

Description

@jirzynek

Hi,

When building some of our shaders DXC crashes with the call stack below.

 	KernelBase.dll!RaiseException�()	Unknown
>	dxcompiler.dll!llvm_assert(const char * _Message, const char * _File, unsigned int _Line, const char * _Function) Line 23	C++
 	dxcompiler.dll!`anonymous namespace'::SROA_Helper::RewriteBitCast(llvm::BitCastInst * BCI) Line 3156	C++
 	dxcompiler.dll!`anonymous namespace'::SROA_Helper::RewriteForScalarRepl(llvm::Value * V, llvm::IRBuilder<1,llvm::ConstantFolder,llvm::IRBuilderDefaultInserter<1> > & Builder) Line 3348	C++
 	dxcompiler.dll!`anonymous namespace'::SROA_Helper::DoScalarReplacement(llvm::Value * V, std::vector<llvm::Value *,std::allocator<llvm::Value *> > & Elts, llvm::IRBuilder<1,llvm::ConstantFolder,llvm::IRBuilderDefaultInserter<1> > & Builder, bool bFlatVector, bool hasPrecise, hlsl::DxilTypeSystem & typeSys, const llvm::DataLayout & DL, llvm::SmallVector<llvm::Value *,32> & DeadInsts) Line 3494	C++
 	dxcompiler.dll!`anonymous namespace'::SROA_Parameter_HLSL::flattenArgument(llvm::Function * F, llvm::Value * Arg, bool bForParam, hlsl::DxilParameterAnnotation & paramAnnotation, std::vector<llvm::Value *,std::allocator<llvm::Value *> > & FlatParamList, std::vector<hlsl::DxilParameterAnnotation,std::allocator<hlsl::DxilParameterAnnotation> > & FlatAnnotationList, llvm::IRBuilder<1,llvm::ConstantFolder,llvm::IRBuilderDefaultInserter<1> > & Builder, llvm::DbgDeclareInst * DDI) Line 5316	C++
 	dxcompiler.dll!`anonymous namespace'::SROA_Parameter_HLSL::createFlattenedFunction(llvm::Function * F) Line 5989	C++
 	dxcompiler.dll!`anonymous namespace'::SROA_Parameter_HLSL::runOnModule(llvm::Module & M) Line 4282	C++
 	dxcompiler.dll!`anonymous namespace'::MPPassManager::runOnModule(llvm::Module & M) Line 1624	C++
 	dxcompiler.dll!llvm::legacy::PassManagerImpl::run(llvm::Module & M) Line 1726	C++
 	dxcompiler.dll!llvm::legacy::PassManager::run(llvm::Module & M) Line 1766	C++
 	dxcompiler.dll!`anonymous namespace'::EmitAssemblyHelper::EmitAssembly(clang::BackendAction Action, llvm::raw_pwrite_stream * OS) Line 721	C++
 	dxcompiler.dll!clang::EmitBackendOutput(clang::DiagnosticsEngine & Diags, const clang::CodeGenOptions & CGOpts, const clang::TargetOptions & TOpts, const clang::LangOptions & LOpts, llvm::StringRef TDesc, llvm::Module * M, clang::BackendAction Action, llvm::raw_pwrite_stream * OS) Line 742	C++
 	dxcompiler.dll!clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext & C) Line 194	C++
 	dxcompiler.dll!clang::ParseAST(clang::Sema & S, bool PrintStats, bool SkipFunctionBodies) Line 162	C++
 	dxcompiler.dll!clang::ASTFrontendAction::ExecuteAction() Line 556	C++
 	dxcompiler.dll!clang::CodeGenAction::ExecuteAction() Line 755	C++
 	dxcompiler.dll!clang::FrontendAction::Execute() Line 468	C++
 	dxcompiler.dll!DxcCompiler::CompileWithDebug(IDxcBlob * pSource, const wchar_t * pSourceName, const wchar_t * pEntryPoint, const wchar_t * pTargetProfile, const wchar_t * * pArguments, unsigned int argCount, const DxcDefine * pDefines, unsigned int defineCount, IDxcIncludeHandler * pIncludeHandler, IDxcOperationResult * * ppResult, wchar_t * * ppDebugBlobName, IDxcBlob * * ppDebugBlob) Line 527	C++
 	dxcompiler.dll!DxcCompiler::Compile(IDxcBlob * pSource, const wchar_t * pSourceName, const wchar_t * pEntryPoint, const wchar_t * pTargetProfile, const wchar_t * * pArguments, unsigned int argCount, const DxcDefine * pDefines, unsigned int defineCount, IDxcIncludeHandler * pIncludeHandler, IDxcOperationResult * * ppResult) Line 277	C++
 	dxc.exe!DxcContext::Compile() Line 822	C++
 	dxc.exe!wmain(int argc, const wchar_t * * argv_) Line 1200	C++
 	dxc.exe!invoke_main() Line 91	C++
 	dxc.exe!__scrt_common_main_seh() Line 283	C++
 	dxc.exe!__scrt_common_main() Line 326	C++
 	dxc.exe!wmainCRTStartup() Line 17	C++
 	kernel32.dll!BaseThreadInitThunk�()	Unknown
 	ntdll.dll!RtlUserThreadStart�()	Unknown

debug output:

Error: assert(0 && "Type mismatch.")
File:
e:\tmp\github\directxshadercompiler\lib\transforms\scalar\scalarreplaggregateshlsl.cpp(3156)
Func:	`anonymous-namespace'::SROA_Helper::RewriteBitCast
Exception thrown at 0x00007FFC7EC2A388 (KernelBase.dll) in dxc.exe: 0xE0000001.
Unhandled exception at 0x00007FFC7EC2A388 (KernelBase.dll) in dxc.exe: 0xE0000001.

I'm getting this crash when using DXC from the official SDK (10.0.17763.0) or using DXC that I build myself from the latest (commit ee00dc1)

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