<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - clang crashes on invalid code on x86_64-linux-gnu"
href="https://llvm.org/bugs/show_bug.cgi?id=24798">24798</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang crashes on invalid code on x86_64-linux-gnu
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>su@cs.ucdavis.edu
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>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
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> 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;
}</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>