[llvm-bugs] [Bug 24798] New: clang crashes on invalid code on x86_64-linux-gnu

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Sep 12 17:43:35 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24798

            Bug ID: 24798
           Summary: clang crashes on invalid code on x86_64-linux-gnu
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The current clang trunk crashes when compiling the following (invalid) code in
both 32-bit and 64-bit modes on x86_64-linux-gnu. 

It seems to affect all clang releases since 3.2, but not 3.1. 


$ clang++-trunk -v
clang version 3.8.0 (trunk 247514)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/tools/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.2
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.1.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.2
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.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.1.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++-trunk -c small.cc
small.cc:6:3: warning: expression result unused [-Wunused-value]
  void_f ();
  ^~~~~~~~~
Cannot create a null constant of that type!
UNREACHABLE executed at /tmp/llvm/lib/IR/Constants.cpp:209!
#0 0x2dcb8ed llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang+0x2dcb8ed)
#1 0x2dcaf76 llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang+0x2dcaf76)
#2 0x2dcd0ee (/usr/local/clang-trunk/bin/clang+0x2dcd0ee)
#3 0x7f0a75c57340 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x7f0a74bf2cc9 gsignal
/build/buildd/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x7f0a74bf60d8 abort /build/buildd/eglibc-2.19/stdlib/abort.c:91:0
#6 0x2db337d llvm::llvm_unreachable_internal(char const*, char const*, unsigned
int) (/usr/local/clang-trunk/bin/clang+0x2db337d)
#7 0x2c3357f (/usr/local/clang-trunk/bin/clang+0x2c3357f)
#8 0xb7d516 (/usr/local/clang-trunk/bin/clang+0xb7d516)
#9 0xb73ad6 clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*,
bool) (/usr/local/clang-trunk/bin/clang+0xb73ad6)
#10 0xb3e7b7 clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*,
clang::CodeGen::AggValueSlot, bool) (/usr/local/clang-trunk/bin/clang+0xb3e7b7)
#11 0xa01452 clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*)
(/usr/local/clang-trunk/bin/clang+0xa01452)
#12 0xa0b8dc
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot)
(/usr/local/clang-trunk/bin/clang+0xa0b8dc)
#13 0xa36f71 clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&)
(/usr/local/clang-trunk/bin/clang+0xa36f71)
#14 0xa49035
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/usr/local/clang-trunk/bin/clang+0xa49035)
#15 0xa4578a
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl,
llvm::GlobalValue*) (/usr/local/clang-trunk/bin/clang+0xa4578a)
#16 0xa4ac35 clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*)
(/usr/local/clang-trunk/bin/clang+0xa4ac35)
#17 0x9be7ef (/usr/local/clang-trunk/bin/clang+0x9be7ef)
#18 0x9b2a67 (/usr/local/clang-trunk/bin/clang+0x9b2a67)
#19 0xc38ec3 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang+0xc38ec3)
#20 0x7750f5 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang+0x7750f5)
#21 0x74247c clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang+0x74247c)
#22 0x7221d7 clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang+0x7221d7)
#23 0x718225 cc1_main(llvm::ArrayRef<char const*>, char const*, void*)
(/usr/local/clang-trunk/bin/clang+0x718225)
#24 0x72086f main (/usr/local/clang-trunk/bin/clang+0x72086f)
#25 0x7f0a74bddec5 __libc_start_main
/build/buildd/eglibc-2.19/csu/libc-start.c:321:0
#26 0x717cb9 _start (/usr/local/clang-trunk/bin/clang+0x717cb9)
Stack dump:
0.    Program arguments: /usr/local/clang-trunk/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
small.cc -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
-fuse-init-array -target-cpu x86-64 -target-linker-version 2.24
-dwarf-column-info -coverage-file /data2/small.cc -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/3.8.0 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/3.8.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -fdeprecated-macro
-fdebug-compilation-dir /data2 -ferror-limit 19 -fmessage-length 234
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o small.o -x c++ small.cc 
1.    <eof> parser at end of file
2.    small.cc:4:1: LLVM IR generation of declaration 'main'
3.    small.cc:4:1: Generating code for declaration 'main'
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.8.0 (trunk 247514)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/tools/bin
clang: 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: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/small-c275f1.cpp
clang: note: diagnostic msg: /tmp/small-c275f1.sh
clang: note: diagnostic msg: 

********************
$ 


-------------------------


typedef void void_f ();

int 
main ()
{
  void_f ();
  return 0; 
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150913/578e8303/attachment-0001.html>


More information about the llvm-bugs mailing list