Description
Compiler Explorer: https://godbolt.org/z/3vbqjEbqb
<source>:7:49: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'const void *' [-Wint-conversion]
7 | unsigned char *y = __builtin_assume_aligned(arg, 16);
| ^~~
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-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 -fsanitize=undefined -fsanitize=address --rtlib=compiler-rt -g -lgcc_s -w -O2 <source>
1. <eof> parser at end of file
2. <source>:4:6: LLVM IR generation of declaration 'foo'
3. <source>:4:6: Generating code for declaration 'foo'
#0 0x0000000003932808 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3932808)
#1 0x0000000003930974 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3930974)
#2 0x0000000003882fb8 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007786dca42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#4 0x0000000003cd953c clang::CodeGen::CodeGenFunction::emitAlignmentAssumptionCheck(llvm::Value*, clang::QualType, clang::SourceLocation, clang::SourceLocation, llvm::Value*, llvm::Value*, llvm::Value*, llvm::Instruction*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3cd953c)
#5 0x0000000003cd9b83 clang::CodeGen::CodeGenFunction::emitAlignmentAssumption(llvm::Value*, clang::QualType, clang::SourceLocation, clang::SourceLocation, llvm::Value*, llvm::Value*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3cd9b83)
#6 0x0000000003cda2a4 clang::CodeGen::CodeGenFunction::emitAlignmentAssumption(llvm::Value*, clang::Expr const*, clang::SourceLocation, llvm::Value*, llvm::Value*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3cda2a4)
#7 0x0000000003ffb847 clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(clang::GlobalDecl, unsigned int, clang::CallExpr const*, clang::CodeGen::ReturnValueSlot) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3ffb847)
#8 0x00000000040dd556 clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*, clang::CodeGen::ReturnValueSlot, llvm::CallBase**) (/opt/compiler-explorer/clang-trunk/bin/clang+0x40dd556)
#9 0x000000000412a4b9 (anonymous namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*) CGExprScalar.cpp:0:0
#10 0x0000000004120adc clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
#11 0x0000000004122cbb (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) CGExprScalar.cpp:0:0
#12 0x000000000412776b (anonymous namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*) CGExprScalar.cpp:0:0
#13 0x00000000041212d2 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
#14 0x0000000004125e22 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x4125e22)
#15 0x000000000407f33b clang::CodeGen::CodeGenFunction::EmitScalarInit(clang::Expr const*, clang::ValueDecl const*, clang::CodeGen::LValue, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x407f33b)
#16 0x0000000004080663 clang::CodeGen::CodeGenFunction::EmitExprAsInit(clang::Expr const*, clang::ValueDecl const*, clang::CodeGen::LValue, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x4080663)
#17 0x000000000408e9fb clang::CodeGen::CodeGenFunction::EmitAutoVarInit(clang::CodeGen::CodeGenFunction::AutoVarEmission const&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x408e9fb)
#18 0x000000000408f6dc clang::CodeGen::CodeGenFunction::EmitVarDecl(clang::VarDecl const&) (.part.0) CGDecl.cpp:0:0
#19 0x000000000408f7a8 clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl const&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x408f7a8)
#20 0x0000000003c5fe2f clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3c5fe2f)
#21 0x0000000003c7517a clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3c7517a)
#22 0x0000000003c6d742 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3c6d742)
#23 0x0000000003c74c29 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3c74c29)
#24 0x0000000003cdc36a clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3cdc36a)
#25 0x0000000003ce6f85 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3ce6f85)
#26 0x0000000003d44beb clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3d44beb)
#27 0x0000000003d40095 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3d40095)
#28 0x0000000003d40ac0 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-trunk/bin/clang+0x3d40ac0)
#29 0x0000000003d4a687 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#30 0x000000000425401e (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#31 0x000000000423e469 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-trunk/bin/clang+0x423e469)
#32 0x0000000006215ac4 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk/bin/clang+0x6215ac4)
#33 0x0000000004251b35 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk/bin/clang+0x4251b35)
#34 0x0000000004517f71 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk/bin/clang+0x4517f71)
#35 0x0000000004497a8b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x4497a8b)
#36 0x00000000045fc2e3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk/bin/clang+0x45fc2e3)
#37 0x0000000000cdf87c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk/bin/clang+0xcdf87c)
#38 0x0000000000cd82dd ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#39 0x000000000429a0a9 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
#40 0x00000000038833e3 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-trunk/bin/clang+0x38833e3)
#41 0x000000000429a2c9 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
#42 0x000000000426173d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+0x426173d)
#43 0x000000000426273d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-trunk/bin/clang+0x426273d)
#44 0x000000000426c26c clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-trunk/bin/clang+0x426c26c)
#45 0x0000000000cdc5d1 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-trunk/bin/clang+0xcdc5d1)
#46 0x0000000000baf834 main (/opt/compiler-explorer/clang-trunk/bin/clang+0xbaf834)
#47 0x00007786dca29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#48 0x00007786dca29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#49 0x0000000000cd7d7e _start (/opt/compiler-explorer/clang-trunk/bin/clang+0xcd7d7e)
clang: error: clang frontend command failed with exit code 139 (use -v to see invocation)
ASM generation compiler returned: 139
<source>:7:49: error: incompatible integer to pointer conversion passing 'int' to parameter of type 'const void *' [-Wint-conversion]
7 | unsigned char *y = __builtin_assume_aligned(arg, 16);
| ^~~
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-trunk-20241001/bin/clang-20 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -dumpdir /app/output.s- -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name example.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -fno-verbose-asm -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debug-info-kind=constructor -dwarf-version=4 -debugger-tuning=gdb -fdebug-compilation-dir=/app -fcoverage-compilation-dir=/app -resource-dir /opt/compiler-explorer/clang-trunk-20241001/lib/clang/20 -internal-isystem /opt/compiler-explorer/clang-trunk-20241001/lib/clang/20/include -internal-isystem /usr/local/include -internal-isystem /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/15.0.0/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -w -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -vectorize-loops -vectorize-slp -fsanitize=address,alignment,array-bounds,bool,builtin,enum,float-cast-overflow,function,integer-divide-by-zero,nonnull-attribute,null,object-size,pointer-overflow,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unreachable,vla-bound,vptr -fsanitize-recover=alignment,array-bounds,bool,builtin,enum,float-cast-overflow,function,integer-divide-by-zero,nonnull-attribute,null,object-size,pointer-overflow,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,vla-bound,vptr -fsanitize-system-ignorelist=/opt/compiler-explorer/clang-trunk-20241001/lib/clang/20/share/asan_ignorelist.txt -fno-sanitize-memory-param-retval -fsanitize-address-use-after-scope -fsanitize-address-globals-dead-stripping -fno-assume-sane-operator-new -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/example-a27a44.o -x c <source>
1. <eof> parser at end of file
2. <source>:4:6: LLVM IR generation of declaration 'foo'
3. <source>:4:6: Generating code for declaration 'foo'
#0 0x0000000003932808 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0x3932808)
#1 0x00000000039303ec SignalHandler(int) Signals.cpp:0:0
#2 0x00007de5a0842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#3 0x0000000003cd953c clang::CodeGen::CodeGenFunction::emitAlignmentAssumptionCheck(llvm::Value*, clang::QualType, clang::SourceLocation, clang::SourceLocation, llvm::Value*, llvm::Value*, llvm::Value*, llvm::Instruction*) (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0x3cd953c)
#4 0x0000000003cd9b83 clang::CodeGen::CodeGenFunction::emitAlignmentAssumption(llvm::Value*, clang::QualType, clang::SourceLocation, clang::SourceLocation, llvm::Value*, llvm::Value*) (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0x3cd9b83)
#5 0x0000000003cda2a4 clang::CodeGen::CodeGenFunction::emitAlignmentAssumption(llvm::Value*, clang::Expr const*, clang::SourceLocation, llvm::Value*, llvm::Value*) (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0x3cda2a4)
#6 0x0000000003ffb847 clang::CodeGen::CodeGenFunction::EmitBuiltinExpr(clang::GlobalDecl, unsigned int, clang::CallExpr const*, clang::CodeGen::ReturnValueSlot) (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0x3ffb847)
#7 0x00000000040dd556 clang::CodeGen::CodeGenFunction::EmitCallExpr(clang::CallExpr const*, clang::CodeGen::ReturnValueSlot, llvm::CallBase**) (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0x40dd556)
#8 0x000000000412a4b9 (anonymous namespace)::ScalarExprEmitter::VisitCallExpr(clang::CallExpr const*) CGExprScalar.cpp:0:0
#9 0x0000000004120adc clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
#10 0x0000000004122cbb (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) CGExprScalar.cpp:0:0
#11 0x000000000412776b (anonymous namespace)::ScalarExprEmitter::VisitCastExpr(clang::CastExpr*) CGExprScalar.cpp:0:0
#12 0x00000000041212d2 clang::StmtVisitorBase<std::add_pointer, (anonymous namespace)::ScalarExprEmitter, llvm::Value*>::Visit(clang::Stmt*) CGExprScalar.cpp:0:0
#13 0x0000000004125e22 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0x4125e22)
#14 0x000000000407f33b clang::CodeGen::CodeGenFunction::EmitScalarInit(clang::Expr const*, clang::ValueDecl const*, clang::CodeGen::LValue, bool) (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0x407f33b)
#15 0x0000000004080663 clang::CodeGen::CodeGenFunction::EmitExprAsInit(clang::Expr const*, clang::ValueDecl const*, clang::CodeGen::LValue, bool) (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0x4080663)
#16 0x000000000408e9fb clang::CodeGen::CodeGenFunction::EmitAutoVarInit(clang::CodeGen::CodeGenFunction::AutoVarEmission const&) (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0x408e9fb)
#17 0x000000000408f6dc clang::CodeGen::CodeGenFunction::EmitVarDecl(clang::VarDecl const&) (.part.0) CGDecl.cpp:0:0
#18 0x000000000408f7a8 clang::CodeGen::CodeGenFunction::EmitDecl(clang::Decl const&) (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0x408f7a8)
#19 0x0000000003c5fe2f clang::CodeGen::CodeGenFunction::EmitDeclStmt(clang::DeclStmt const&) (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0x3c5fe2f)
#20 0x0000000003c7517a clang::CodeGen::CodeGenFunction::EmitSimpleStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0x3c7517a)
#21 0x0000000003c6d742 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*, llvm::ArrayRef<clang::Attr const*>) (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0x3c6d742)
#22 0x0000000003c74c29 clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0x3c74c29)
#23 0x0000000003cdc36a clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::Stmt const*) (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0x3cdc36a)
#24 0x0000000003ce6f85 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0x3ce6f85)
#25 0x0000000003d44beb clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0x3d44beb)
#26 0x0000000003d40095 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0x3d40095)
#27 0x0000000003d40ac0 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0x3d40ac0)
#28 0x0000000003d4a687 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) (.part.0) CodeGenModule.cpp:0:0
#29 0x000000000425401e (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) ModuleBuilder.cpp:0:0
#30 0x000000000423e469 clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0x423e469)
#31 0x0000000006215ac4 clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0x6215ac4)
#32 0x0000000004251b35 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0x4251b35)
#33 0x0000000004517f71 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0x4517f71)
#34 0x0000000004497a8b clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0x4497a8b)
#35 0x00000000045fc2e3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0x45fc2e3)
#36 0x0000000000cdf87c cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0xcdf87c)
#37 0x0000000000cd82dd ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#38 0x0000000000cdc44f clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0xcdc44f)
#39 0x0000000000baf834 main (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0xbaf834)
#40 0x00007de5a0829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#41 0x00007de5a0829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#42 0x0000000000cd7d7e _start (/opt/compiler-explorer/clang-trunk-20241001/bin/clang-20+0xcd7d7e)
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Execution build compiler returned: 254
Code:
#include <stdio.h>
void foo(int arg) {
int x = 0;
unsigned char *y = __builtin_assume_aligned(arg, 16);
for (int i = 0; i < 8; ++i) {
x = y[i];
printf("Value of x in the loop: %d\n", x);
}
return;
}