Skip to content

DXC crashes on simple HLSL input #7395

@jimblandy

Description

@jimblandy
Contributor

When invoked as dxc -HV 2018 -T cs_6_7 -E main naga-crashes-dxc/reduced.hlsl, the following input makes DXC crash:

void main()
{
    int i = asuint(int(1));
}

I'm running DXC 34b6d0f on Linux, built as follows:

cmake ..                                        \
  -C ../cmake/caches/PredefinedParams.cmake     \
  -DCMAKE_BUILD_TYPE=Debug                \
  -DHLSL_INCLUDE_TESTS=OFF                      \
  -DCLANG_INCLUDE_TESTS=OFF                     \
  -DLLVM_INCLUDE_TESTS=OFF                      \
  -DHLSL_BUILD_DXILCONV=OFF                     \
  -DSPIRV_WERROR=OFF                            \
  -DENABLE_SPIRV_CODEGEN=OFF                    \
  -DLLVM_ENABLE_ASSERTIONS=ON                   \
  -DLLVM_ASSERTIONS_NO_STRINGS=ON               \
  -DLLVM_ASSERTIONS_TRAP=ON                     \
  -DDXC_CODEGEN_EXCEPTIONS_TRAP=ON              \
  -DDXC_DISABLE_ALLOCATOR_OVERRIDES=ON          \
  -G Ninja

The call stack is as follows:

Call stack at crash
#0  (anonymous namespace)::llvm_assert_trap (_Message=0x7ffff7051ce0 "", _File=0x7ffff7051ce0 "", _Line=0, _Function=0x7ffff7051ce0 "")
    at /home/jimb/DirectXShaderCompiler/lib/Support/assert.cpp:20
#1  0x00007ffff518fb81 in llvm_assert (Message=0x7ffff7051ce0 "", File=0x7ffff7051ce0 "", Line=0, Function=0x7ffff7051ce0 "") at /home/jimb/DirectXShaderCompiler/lib/Support/assert.cpp:44
#2  0x00007ffff5f3426d in (anonymous namespace)::IntExprEvaluator::Success (this=0x7fffffff5190, SI=..., E=0x8ed080, Result=...)
    at /home/jimb/DirectXShaderCompiler/tools/clang/lib/AST/ExprConstant.cpp:6201
#3  0x00007ffff5f34398 in (anonymous namespace)::IntExprEvaluator::Success (this=0x7fffffff5190, SI=..., E=0x8ed080)
    at /home/jimb/DirectXShaderCompiler/tools/clang/lib/AST/ExprConstant.cpp:6209
#4  0x00007ffff5f34804 in (anonymous namespace)::IntExprEvaluator::Success (this=0x7fffffff5190, V=..., E=0x8ed080)
    at /home/jimb/DirectXShaderCompiler/tools/clang/lib/AST/ExprConstant.cpp:6245
#5  0x00007ffff5f722e9 in (anonymous namespace)::ExprEvaluatorBase<(anonymous namespace)::IntExprEvaluator>::DerivedSuccess (this=0x7fffffff5190, V=..., E=0x8ed080)
    at /home/jimb/DirectXShaderCompiler/tools/clang/lib/AST/ExprConstant.cpp:4039
#6  0x00007ffff5f5600e in (anonymous namespace)::ExprEvaluatorBase<(anonymous namespace)::IntExprEvaluator>::VisitCallExpr (this=0x7fffffff5190, E=0x8ed080)
    at /home/jimb/DirectXShaderCompiler/tools/clang/lib/AST/ExprConstant.cpp:4299
#7  0x00007ffff5f3594f in (anonymous namespace)::IntExprEvaluator::VisitCallExpr (this=0x7fffffff5190, E=0x8ed080)
    at /home/jimb/DirectXShaderCompiler/tools/clang/lib/AST/ExprConstant.cpp:6550
#8  0x00007ffff5f54e54 in clang::StmtVisitorBase::Visit (this=0x7fffffff5190, S=0x8ed080)
    at /home/jimb/DirectXShaderCompiler/build/tools/clang/include/clang/AST/StmtNodes.inc:305
#9  0x00007ffff5f416cb in Evaluate (Result=..., Info=..., E=0x8ed080) at /home/jimb/DirectXShaderCompiler/tools/clang/lib/AST/ExprConstant.cpp:8712
#10 0x00007ffff5f420a4 in EvaluateAsRValue (Info=..., E=0x8ed080, Result=...) at /home/jimb/DirectXShaderCompiler/tools/clang/lib/AST/ExprConstant.cpp:8801
#11 0x00007ffff5f424ae in clang::Expr::EvaluateAsRValue (this=0x8ed080, Result=..., Ctx=...) at /home/jimb/DirectXShaderCompiler/tools/clang/lib/AST/ExprConstant.cpp:8857
#12 0x00007ffff5f42e89 in CheckEvalInICE (E=0x8ed080, Ctx=...) at /home/jimb/DirectXShaderCompiler/tools/clang/lib/AST/ExprConstant.cpp:9010
#13 0x00007ffff5f433bc in CheckICE (E=0x8ed080, Ctx=...) at /home/jimb/DirectXShaderCompiler/tools/clang/lib/AST/ExprConstant.cpp:9140
#14 0x00007ffff5f444dc in clang::Expr::isIntegerConstantExpr (this=0x8ed080, Ctx=..., Loc=0x0) at /home/jimb/DirectXShaderCompiler/tools/clang/lib/AST/ExprConstant.cpp:9432
#15 0x00007ffff5f0aa41 in clang::Expr::isNullPointerConstant (this=0x8ed080, Ctx=..., NPC=clang::Expr::NPC_ValueDependentIsNotNull)
    at /home/jimb/DirectXShaderCompiler/tools/clang/lib/AST/Expr.cpp:3376
#16 0x00007ffff5d20321 in (anonymous namespace)::DiagnoseNullConversion (S=..., E=0x8ed080, T=..., CC=...) at /home/jimb/DirectXShaderCompiler/tools/clang/lib/Sema/SemaChecking.cpp:6922
#17 0x00007ffff5d21765 in (anonymous namespace)::CheckImplicitConversion (S=..., E=0x8ed080, T=..., CC=..., ICContext=0x0)
    at /home/jimb/DirectXShaderCompiler/tools/clang/lib/Sema/SemaChecking.cpp:7210
#18 0x00007ffff5d22272 in (anonymous namespace)::AnalyzeImplicitConversions (S=..., OrigE=0x8ed0b0, CC=...) at /home/jimb/DirectXShaderCompiler/tools/clang/lib/Sema/SemaChecking.cpp:7380
#19 0x00007ffff5d23904 in clang::Sema::CheckImplicitConversions (this=0x8a2ff0, E=0x8ed0b0, CC=...) at /home/jimb/DirectXShaderCompiler/tools/clang/lib/Sema/SemaChecking.cpp:7695
#20 0x00007ffff5d255b0 in clang::Sema::CheckCompletedExpr (this=0x8a2ff0, E=0x8ed0b0, CheckLoc=..., IsConstexpr=false)
    at /home/jimb/DirectXShaderCompiler/tools/clang/lib/Sema/SemaChecking.cpp:8208
#21 0x00007ffff5901001 in clang::Sema::ActOnFinishFullExpr (this=0x8a2ff0, FE=0x8ed0b0, CC=..., DiscardedValue=false, IsConstexpr=false, IsLambdaInitCaptureInitializer=false)
    at /home/jimb/DirectXShaderCompiler/tools/clang/lib/Sema/SemaExprCXX.cpp:6772
#22 0x00007ffff56dcf35 in clang::Sema::AddInitializerToDecl (this=0x8a2ff0, RealDecl=0x8ecc18, Init=0x8ed0b0, DirectInit=false, TypeMayContainAuto=false)
    at /home/jimb/DirectXShaderCompiler/tools/clang/lib/Sema/SemaDecl.cpp:9280
#23 0x00007ffff65380ac in clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes (this=0x8a5c10, D=..., TemplateInfo=..., FRI=0x0)
    at /home/jimb/DirectXShaderCompiler/tools/clang/lib/Parse/ParseDecl.cpp:2728
#24 0x00007ffff6536e36 in clang::Parser::ParseDeclGroup (this=0x8a5c10, DS=..., Context=7, DeclEnd=0x7fffffff80c8, FRI=0x0)
    at /home/jimb/DirectXShaderCompiler/tools/clang/lib/Parse/ParseDecl.cpp:2472
#25 0x00007ffff6535ba8 in clang::Parser::ParseSimpleDeclaration (this=0x8a5c10, Context=7, DeclEnd=..., Attrs=..., RequireSemi=true, FRI=0x0)
    at /home/jimb/DirectXShaderCompiler/tools/clang/lib/Parse/ParseDecl.cpp:2116
#26 0x00007ffff65358ef in clang::Parser::ParseDeclaration (this=0x8a5c10, Context=7, DeclEnd=..., attrs=...) at /home/jimb/DirectXShaderCompiler/tools/clang/lib/Parse/ParseDecl.cpp:2061
#27 0x00007ffff65ac878 in clang::Parser::ParseStatementOrDeclarationAfterAttributes (this=0x8a5c10, Stmts=..., OnlyStatement=false, TrailingElseLoc=0x0, Attrs=...)
    at /home/jimb/DirectXShaderCompiler/tools/clang/lib/Parse/ParseStmt.cpp:244
#28 0x00007ffff65ac0be in clang::Parser::ParseStatementOrDeclaration (this=0x8a5c10, Stmts=..., OnlyStatement=false, TrailingElseLoc=0x0)
    at /home/jimb/DirectXShaderCompiler/tools/clang/lib/Parse/ParseStmt.cpp:107
#29 0x00007ffff65afaba in clang::Parser::ParseCompoundStatementBody (this=0x8a5c10, isStmtExpr=false) at /home/jimb/DirectXShaderCompiler/tools/clang/lib/Parse/ParseStmt.cpp:1049
#30 0x00007ffff65b2f05 in clang::Parser::ParseFunctionStatementBody (this=0x8a5c10, Decl=0x8ecab0, BodyScope=...)
    at /home/jimb/DirectXShaderCompiler/tools/clang/lib/Parse/ParseStmt.cpp:1983
#31 0x00007ffff651d204 in clang::Parser::ParseFunctionDefinition (this=0x8a5c10, D=..., TemplateInfo=..., LateParsedAttrs=0x7fffffff8a60)
    at /home/jimb/DirectXShaderCompiler/tools/clang/lib/Parse/Parser.cpp:1177
#32 0x00007ffff6536b06 in clang::Parser::ParseDeclGroup (this=0x8a5c10, DS=..., Context=0, DeclEnd=0x0, FRI=0x0) at /home/jimb/DirectXShaderCompiler/tools/clang/lib/Parse/ParseDecl.cpp:2419
#33 0x00007ffff651c5aa in clang::Parser::ParseDeclOrFunctionDefInternal (this=0x8a5c10, attrs=..., DS=..., AS=clang::AS_none)
    at /home/jimb/DirectXShaderCompiler/tools/clang/lib/Parse/Parser.cpp:965
#34 0x00007ffff651c682 in clang::Parser::ParseDeclarationOrFunctionDefinition (this=0x8a5c10, attrs=..., DS=0x0, AS=clang::AS_none)
    at /home/jimb/DirectXShaderCompiler/tools/clang/lib/Parse/Parser.cpp:981
#35 0x00007ffff651be46 in clang::Parser::ParseExternalDeclaration (this=0x8a5c10, attrs=..., DS=0x0) at /home/jimb/DirectXShaderCompiler/tools/clang/lib/Parse/Parser.cpp:839
#36 0x00007ffff651afae in clang::Parser::ParseTopLevelDecl (this=0x8a5c10, Result=...) at /home/jimb/DirectXShaderCompiler/tools/clang/lib/Parse/Parser.cpp:606
#37 0x00007ffff65171e7 in clang::ParseAST (S=..., PrintStats=false, SkipFunctionBodies=false) at /home/jimb/DirectXShaderCompiler/tools/clang/lib/Parse/ParseAST.cpp:140
#38 0x00007ffff5579d79 in clang::ASTFrontendAction::ExecuteAction (this=0x7fffffff9fd0) at /home/jimb/DirectXShaderCompiler/tools/clang/lib/Frontend/FrontendAction.cpp:554
#39 0x00007ffff523f28c in clang::CodeGenAction::ExecuteAction (this=0x7fffffff9fd0) at /home/jimb/DirectXShaderCompiler/tools/clang/lib/CodeGen/CodeGenAction.cpp:808
#40 0x00007ffff5579871 in clang::FrontendAction::Execute (this=0x7fffffff9fd0) at /home/jimb/DirectXShaderCompiler/tools/clang/lib/Frontend/FrontendAction.cpp:455
#41 0x00007ffff4a21ed2 in DxcCompiler::Compile (this=0x861e10, pSource=0x7fffffffc420, pArguments=0x861d20, argCount=7, pIncludeHandler=0x861950, riid=..., ppResult=0x7fffffffc3e8)
    at /home/jimb/DirectXShaderCompiler/tools/clang/tools/dxcompiler/dxcompilerobj.cpp:986
#42 0x00007ffff4a14b97 in hlsl::DxcCompilerAdapter::WrapCompile (this=0x862230, bPreprocess=false, pSource=0x8623c0, pSourceName=0x862280 L"naga-crashes-dxc/reduced.hlsl", 
    pEntryPoint=0x862420 L"main", pTargetProfile=0x862250 L"cs_6_7", pArguments=0x861da0, argCount=6, pDefines=0x7fffffffcd28, defineCount=0, pIncludeHandler=0x861950, 
    ppResult=0x7fffffffc830, ppDebugBlobName=0x0, ppDebugBlob=0x0) at /home/jimb/DirectXShaderCompiler/tools/clang/tools/dxcompiler/dxcompilerobj.cpp:1950
#43 0x00007ffff4a1438c in hlsl::DxcCompilerAdapter::CompileWithDebug (this=0x862230, pSource=0x8623c0, pSourceName=0x862280 L"naga-crashes-dxc/reduced.hlsl", pEntryPoint=0x862420 L"main", 
    pTargetProfile=0x862250 L"cs_6_7", pArguments=0x861da0, argCount=6, pDefines=0x7fffffffcd28, defineCount=0, pIncludeHandler=0x861950, ppResult=0x7fffffffc830, ppDebugBlobName=0x0, 
    ppDebugBlob=0x0) at /home/jimb/DirectXShaderCompiler/tools/clang/tools/dxcompiler/dxcompilerobj.cpp:1853
#44 0x00007ffff4a1be5d in hlsl::DxcCompilerAdapter::Compile (this=0x862230, pSource=0x8623c0, pSourceName=0x862280 L"naga-crashes-dxc/reduced.hlsl", pEntryPoint=0x862420 L"main", 
    pTargetProfile=0x862250 L"cs_6_7", pArguments=0x861da0, argCount=6, pDefines=0x7fffffffcd28, defineCount=0, pIncludeHandler=0x861950, ppResult=0x7fffffffc830)
    at /home/jimb/DirectXShaderCompiler/tools/clang/tools/dxcompiler/dxcompileradapter.h:75
#45 0x00000000004080ad in DxcContext::Compile (this=0x7fffffffd5d0) at /home/jimb/DirectXShaderCompiler/tools/clang/tools/dxclib/dxc.cpp:874
#46 0x000000000040b371 in dxc::main (argc=8, argv_=0x7fffffffd7b8) at /home/jimb/DirectXShaderCompiler/tools/clang/tools/dxclib/dxc.cpp:1502
#47 0x0000000000402416 in main (argc=8, argv_=0x7fffffffd7b8) at /home/jimb/DirectXShaderCompiler/tools/clang/tools/dxc/dxcmain.cpp:19

Activity

added 2 commits that reference this issue on Apr 29, 2025
d421b33
04027a4
added 2 commits that reference this issue on May 2, 2025
df39678
9b08c38
added a commit that references this issue on Jul 21, 2025
2a146e2
jimblandy

jimblandy commented on Jul 21, 2025

@jimblandy
Author
jimblandy

jimblandy commented on Jul 22, 2025

@jimblandy
ContributorAuthor

Closed the wrong issue. Sorry.

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

    bugBug, regression, crashneeds-triageAwaiting triage

    Type

    No type

    Projects

    Status

    Triaged

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @jimblandy

      Issue actions

        DXC crashes on simple HLSL input · Issue #7395 · microsoft/DirectXShaderCompiler