<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/153997>153997</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang][bytecode] Assertion `bigVal.data() && "Null pointer detected!"' failed.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
crash,
clang:bytecode
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
k-arrows
</td>
</tr>
</table>
<pre>
Reproducer:
https://godbolt.org/z/KhcPv5798
```c
#include <stdint.h>
typedef union {
struct {
uint64_t lo;
uint64_t hi;
} s;
__uint128_t n;
} u;
int foo(void) {
const u U = {.s = {0x123ULL, 0xfffULL}};
if (U.n)
return 1;
return 0;
}
```
Backtrace:
```console
clang: /root/llvm-project/llvm/lib/Support/APInt.cpp:92: void llvm::APInt::initFromArray(llvm::ArrayRef<long unsigned int>): Assertion `bigVal.data() && "Null pointer detected!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/clang -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -fexperimental-new-constant-interpreter <source>
1. <eof> parser at end of file
2. <source>:11:5: LLVM IR generation of declaration 'foo'
3. <source>:11:5: Generating code for declaration 'foo'
#0 0x0000000004026d28 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4026d28)
#1 0x0000000004024154 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4024154)
#2 0x0000000003f68988 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x000072264be42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x000072264be969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
#5 0x000072264be42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#6 0x000072264be287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#7 0x000072264be2871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#8 0x000072264be39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#9 0x0000000003f3f21d (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3f3f21d)
#10 0x0000000007baceb9 clang::interp::IntegralAP<false>::toAPValue(clang::ASTContext const&) const (.isra.0) Pointer.cpp:0:0
#11 0x0000000007bb44b9 clang::interp::Pointer::toRValue(clang::interp::Context const&, clang::QualType) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x7bb44b9)
#12 0x00000000079d0e56 bool clang::interp::EvalEmitter::emitRet<(clang::interp::PrimType)13>(clang::interp::SourceInfo const&) (.part.0) EvalEmitter.cpp:0:0
#13 0x00000000079fef70 clang::interp::EvalEmitter::emitRet(clang::interp::PrimType, clang::interp::SourceInfo const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x79fef70)
#14 0x0000000007e30020 clang::interp::Compiler<clang::interp::EvalEmitter>::visitExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x7e30020)
#15 0x00000000079c5891 clang::interp::EvalEmitter::interpretExpr(clang::Expr const*, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x79c5891)
#16 0x00000000079b8ecf clang::interp::Context::evaluateAsRValue(clang::interp::State&, clang::Expr const*, clang::APValue&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x79b8ecf)
#17 0x00000000079328e3 EvaluateAsRValue((anonymous namespace)::EvalInfo&, clang::Expr const*, clang::APValue&) ExprConstant.cpp:0:0
#18 0x000000000793856e EvaluateAsInt(clang::Expr const*, clang::Expr::EvalResult&, clang::ASTContext const&, clang::Expr::SideEffectsKind, (anonymous namespace)::EvalInfo&) ExprConstant.cpp:0:0
#19 0x00000000079388ae clang::Expr::EvaluateAsInt(clang::Expr::EvalResult&, clang::ASTContext const&, clang::Expr::SideEffectsKind, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x79388ae)
#20 0x00000000043edeb3 (anonymous namespace)::ScalarExprEmitter::VisitMemberExpr(clang::MemberExpr*) CGExprScalar.cpp:0:0
#21 0x00000000043e6d87 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
#22 0x00000000043e85fb (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) CGExprScalar.cpp:0:0
#23 0x00000000043ee1fb (anonymous namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*) CGExprScalar.cpp:0:0
#24 0x00000000043e67d1 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
#25 0x00000000043eab7c clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x43eab7c)
#26 0x0000000004350d4d clang::CodeGen::CodeGenFunction::EvaluateExprAsBool(clang::Expr const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4350d4d)
#27 0x000000000456eb8a clang::CodeGen::CodeGenFunction::EmitBranchOnBoolExpr(clang::Expr const*, llvm::BasicBlock*, llvm::BasicBlock*, unsigned long, clang::Stmt::Likelihood, clang::Expr const*, clang::VarDecl const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x456eb8a)
#28 0x0000000004501af3 clang::CodeGen::CodeGenFunction::EmitIfStmt(clang::IfStmt const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4501af3)
#29 0x00000000044fa60e clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44fa60e)
#30 0x00000000045024fc clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x45024fc)
#31 0x00000000045699ce clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x45699ce)
#32 0x000000000457b674 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x457b674)
#33 0x00000000045e6aad clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x45e6aad)
#34 0x00000000045e1a84 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x45e1a84)
#35 0x00000000045e29c0 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x45e29c0)
#36 0x00000000045eccf3 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#37 0x00000000049cd1b0 (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#38 0x00000000049bcb84 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x49bcb84)
#39 0x00000000066d75e4 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x66d75e4)
#40 0x00000000049c8d28 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x49c8d28)
#41 0x0000000004cbcd15 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4cbcd15)
#42 0x0000000004c38f6e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4c38f6e)
#43 0x0000000004dae5f1 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4dae5f1)
#44 0x0000000000db0c0f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xdb0c0f)
#45 0x0000000000da786a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#46 0x0000000004a30739 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#47 0x0000000003f68e24 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3f68e24)
#48 0x0000000004a30d4f clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#49 0x00000000049f2fbd clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x49f2fbd)
#50 0x00000000049f404e clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x49f404e)
#51 0x00000000049fbae5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x49fbae5)
#52 0x0000000000dad0c5 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xdad0c5)
#53 0x0000000000c61054 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xc61054)
#54 0x000072264be29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#55 0x000072264be29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#56 0x0000000000da7315 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xda7315)
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzkW9ty2ziTfhr4BiUVCZ4vfEHLdjbze3a8ViZ7qQIBUMKaAlgA6Mj79FsgKPEgyYdEmdqtncpUSBwa39fd6G5CCNaarwVj1yC6AdHtFW7MRqrr5xlWSv7QV4Wkr9dPrFaSNoQpEOTAyzfG1No-onuA7teSFrIyc6nWAN3_N0D3_9qQx5coyVLg5SD23B9iX1DABakayiAIFtpQLsx8A4I72-fl5rVmlJWwEVwKCJIb4OUQaqMaYg6vEDZcmDhcGVhJEBw1bvi-ESS3UO9fVis7wkfpykDhGm1_0z16ORcGllIClL5ITgHKDisSKbSBDfwbguDWts71_snb-Sj4--EBoAX0dmVZ2ufk1v7Zy4WQlxCg9O-5ACjr0CpmGiWgPxjVNXkHbEPluUE3mDwbhQlzZuhVK4WWFQNeTios1iDIIUD3SkoD0H1VvWxntZL_xcj-1f7FC4Dul01dS2Wb88evwsxJXYMgz5CVYLUA29FBDoK8HeAeueDmXsltrhR-BSgdDLItT6wEwaKSYg0b0XoXhdzOvbP8gxzmWjNlWhPHXsHX33E1p9hggNJW7SgGKIYAoX9vq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