https://llvm.org/bugs/show_bug.cgi?id=31795
Bug ID: 31795 Summary: clang crashes on valid code with -fsanitize=undefined on x86_64-linux-gnu: Assertion `C1->getType() == C2->getType() && "Operand types in binary constant expres sion should match"' failed Product: clang Version: unspecified Hardware: PC OS: All Status: NEW Severity: normal Priority: P Component: -New Bugs Assignee: unassignedclangb...@nondot.org Reporter: s...@cs.ucdavis.edu CC: llvm-bugs@lists.llvm.org Classification: Unclassified This looks like a recent regression. $ clang -v clang version 5.0.0 (trunk 293389) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/local/clang-trunk/bin Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9 Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.4 Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5 Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.4 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.2.0 Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Candidate multilib: x32;@mx32 Selected multilib: .;@m64 $ $ clang -fsanitize=undefined small.c clang-5.0: /tmp/llvm-builder/llvm-source-trunk/lib/IR/Constants.cpp:1735: static llvm::Constant* llvm::ConstantExpr::get(unsigned int, llvm::Constant*, llvm::Constant*, unsigned int, llvm::Type*): Assertion `C1->getType() == C2->getType() && "Operand types in binary constant expression should match"' failed. #0 0x00000000020583f5 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/usr/local/clang-trunk/bin/clang-5.0+0x20583f5) #1 0x000000000205651e llvm::sys::RunSignalHandlers() (/usr/local/clang-trunk/bin/clang-5.0+0x205651e) #2 0x0000000002056680 SignalHandler(int) (/usr/local/clang-trunk/bin/clang-5.0+0x2056680) #3 0x00007f7e4122c330 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10330) #4 0x00007f7e40018c37 gsignal /build/eglibc-oGUzwX/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0 #5 0x00007f7e4001c028 abort /build/eglibc-oGUzwX/eglibc-2.19/stdlib/abort.c:91:0 #6 0x00007f7e40011bf6 __assert_fail_base /build/eglibc-oGUzwX/eglibc-2.19/assert/assert.c:92:0 #7 0x00007f7e40011ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2) #8 0x0000000001b9e9c0 llvm::ConstantExpr::get(unsigned int, llvm::Constant*, llvm::Constant*, unsigned int, llvm::Type*) (/usr/local/clang-trunk/bin/clang-5.0+0x1b9e9c0) #9 0x00000000022bbd2b llvm::IRBuilder<llvm::ConstantFolder, clang::CodeGen::CGBuilderInserter>::CreateSub(llvm::Value*, llvm::Value*, llvm::Twine const&, bool, bool) (/usr/local/clang-trunk/bin/clang-5.0+0x22bbd2b) #10 0x00000000023a77b2 (anonymous namespace)::ScalarExprEmitter::EmitShl((anonymous namespace)::BinOpInfo const&) (/usr/local/clang-trunk/bin/clang-5.0+0x23a77b2) #11 0x00000000023af6b1 (anonymous namespace)::ScalarExprEmitter::Visit(clang::Expr*) (/usr/local/clang-trunk/bin/clang-5.0+0x23af6b1) #12 0x00000000023b16d3 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) (/usr/local/clang-trunk/bin/clang-5.0+0x23b16d3) #13 0x000000000221d33a clang::CodeGen::CodeGenFunction::EmitReturnStmt(clang::ReturnStmt const&) (/usr/local/clang-trunk/bin/clang-5.0+0x221d33a) #14 0x000000000222049f clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt const&, bool, clang::CodeGen::AggValueSlot) (/usr/local/clang-trunk/bin/clang-5.0+0x222049f) #15 0x0000000002249552 clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&, clang::Stmt const*) (/usr/local/clang-trunk/bin/clang-5.0+0x2249552) #16 0x00000000022542cb clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl, llvm::Function*, clang::CodeGen::CGFunctionInfo const&) (/usr/local/clang-trunk/bin/clang-5.0+0x22542cb) #17 0x0000000002276681 clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/usr/local/clang-trunk/bin/clang-5.0+0x2276681) #18 0x0000000002283001 clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) (/usr/local/clang-trunk/bin/clang-5.0+0x2283001) #19 0x0000000002283f21 clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) (/usr/local/clang-trunk/bin/clang-5.0+0x2283f21) #20 0x0000000002284614 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) [clone .part.7081] (/usr/local/clang-trunk/bin/clang-5.0+0x2284614) #21 0x0000000002880e4b (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) (/usr/local/clang-trunk/bin/clang-5.0+0x2880e4b) #22 0x000000000287897c clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) (/usr/local/clang-trunk/bin/clang-5.0+0x287897c) #23 0x0000000002c65e7e clang::ParseAST(clang::Sema&, bool, bool) (/usr/local/clang-trunk/bin/clang-5.0+0x2c65e7e) #24 0x000000000287f65a clang::CodeGenAction::ExecuteAction() (/usr/local/clang-trunk/bin/clang-5.0+0x287f65a) #25 0x000000000253ffce clang::FrontendAction::Execute() (/usr/local/clang-trunk/bin/clang-5.0+0x253ffce) #26 0x0000000002516b0e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/local/clang-trunk/bin/clang-5.0+0x2516b0e) #27 0x00000000025d5042 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/local/clang-trunk/bin/clang-5.0+0x25d5042) #28 0x0000000000c28b68 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/local/clang-trunk/bin/clang-5.0+0xc28b68) #29 0x0000000000bc67f5 main (/usr/local/clang-trunk/bin/clang-5.0+0xbc67f5) #30 0x00007f7e40003f45 __libc_start_main /build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0 #31 0x0000000000c24809 _start (/usr/local/clang-trunk/bin/clang-5.0+0xc24809) Stack dump: 0. Program arguments: /usr/local/clang-trunk/bin/clang-5.0 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name small.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -resource-dir /usr/local/clang-trunk/bin/../lib/clang/5.0.0 -internal-isystem /usr/local/include -internal-isystem /usr/local/clang-trunk/bin/../lib/clang/5.0.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir /data2 -ferror-limit 19 -fmessage-length 141 -fsanitize=alignment,array-bounds,bool,enum,float-cast-overflow,float-divide-by-zero,function,integer-divide-by-zero,nonnull-attribute,null,object-size,return,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,unreachable,vla-bound,vptr -fsanitize-recover=alignment,array-bounds,bool,enum,float-cast-overflow,float-divide-by-zero,function,integer-divide-by-zero,nonnull-attribute,null,object-size,returns-nonnull-attribute,shift-base,shift-exponent,signed-integer-overflow,vla-bound,vptr -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/small-8e7553.o -x c small.c 1. <eof> parser at end of file 2. small.c:1:5: LLVM IR generation of declaration 'main' 3. small.c:1:5: Generating code for declaration 'main' clang-5.0: error: unable to execute command: Aborted (core dumped) clang-5.0: error: clang frontend command failed due to signal (use -v to see invocation) clang version 5.0.0 (trunk 293389) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /usr/local/clang-trunk/bin clang-5.0: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script. clang-5.0: note: diagnostic msg: ******************** PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: clang-5.0: note: diagnostic msg: /tmp/small-b90fe5.c clang-5.0: note: diagnostic msg: /tmp/small-b90fe5.sh clang-5.0: note: diagnostic msg: ******************** $ -------------------------- int main () { return 0 << 0L; } -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs