[LLVMbugs] [Bug 21978] New: clang crashes at -Os and above on x86_64-linux-gnu

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Dec 19 08:16:47 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=21978

            Bug ID: 21978
           Summary: clang crashes at -Os and above 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: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The current clang trunk crashes when compiling the following test case at -Os
and above in both 32-bit and 64-bit modes on x86_64-linux-gnu. 

This is a regression from clang 3.5.0. 

$ clang-trunk -v
clang version 3.6.0 (trunk 224567)
Target: x86_64-unknown-linux-gnu
Thread model: posix
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.1
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
$ 
$ clang-trunk -O1 -c small.c
$ clang-3.5.0 -Os -c small.c
$ 
$ clang-trunk -Os -c small.c
clang: /tmp/llvm/include/llvm/Support/Casting.h:237: typename
llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = llvm::Instruction; Y
= llvm::Value; typename llvm::cast_retty<X, Y*>::ret_type =
llvm::Instruction*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of
incompatible type!"' failed.
#0 0x2a0a092 llvm::sys::PrintStackTrace(_IO_FILE*)
(/usr/local/clang-trunk/bin/clang+0x2a0a092)
#1 0x2a0802b (/usr/local/clang-trunk/bin/clang+0x2a0802b)
#2 0x7f0c1d93ecb0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0xfcb0)
#3 0x7f0c1ce7f0d5 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x360d5)
#4 0x7f0c1ce8283b abort (/lib/x86_64-linux-gnu/libc.so.6+0x3983b)
#5 0x7f0c1ce77d9e (/lib/x86_64-linux-gnu/libc.so.6+0x2ed9e)
#6 0x7f0c1ce77e42 (/lib/x86_64-linux-gnu/libc.so.6+0x2ee42)
#7 0xa2abf0 (/usr/local/clang-trunk/bin/clang+0xa2abf0)
#8 0xa2d43b (/usr/local/clang-trunk/bin/clang+0xa2d43b)
#9 0x22460e7 (/usr/local/clang-trunk/bin/clang+0x22460e7)
#10 0x22462b0 (/usr/local/clang-trunk/bin/clang+0x22462b0)
#11 0x224797c (/usr/local/clang-trunk/bin/clang+0x224797c)
#12 0x224d638 (/usr/local/clang-trunk/bin/clang+0x224d638)
#13 0x224f338 (/usr/local/clang-trunk/bin/clang+0x224f338)
#14 0x298d32f llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang+0x298d32f)
#15 0x298d37b llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang+0x298d37b)
#16 0x298eabf llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang+0x298eabf)
#17 0x94ba27 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::StringRef, llvm::Module*, clang::BackendAction,
llvm::raw_ostream*) (/usr/local/clang-trunk/bin/clang+0x94ba27)
#18 0x93c714 (/usr/local/clang-trunk/bin/clang+0x93c714)
#19 0xb2cdea clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang+0xb2cdea)
#20 0x93e9f1 clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang+0x93e9f1)
#21 0x75c016 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang+0x75c016)
#22 0x7398ae clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang+0x7398ae)
#23 0x71b98c clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang+0x71b98c)
#24 0x7124a8 cc1_main(llvm::ArrayRef<char const*>, char const*, void*)
(/usr/local/clang-trunk/bin/clang+0x7124a8)
#25 0x71aca2 main (/usr/local/clang-trunk/bin/clang+0x71aca2)
#26 0x7f0c1ce6a76d __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2176d)
#27 0x711219 _start (/usr/local/clang-trunk/bin/clang+0x711219)
Stack dump:
0.    Program arguments: /usr/local/clang-trunk/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name small.c
-mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-target-linker-version 2.22 -momit-leaf-frame-pointer -dwarf-column-info
-coverage-file /home/su/small.c -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/3.6.0 -internal-isystem
/usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/3.6.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -Os -fdebug-compilation-dir /home/su
-ferror-limit 19 -fmessage-length 98 -mstackrealign -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o small.o -x c small.c 
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'Function Pass Manager' on module 'small.c'.
4.    Running pass 'CodeGen Prepare' on function '@fn2'
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.6.0 (trunk 224567)
Target: x86_64-unknown-linux-gnu
Thread model: posix
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-e006bd.c
clang: note: diagnostic msg: /tmp/small-e006bd.sh
clang: note: diagnostic msg: 

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


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


int a, b, c[2], e;
short d;

short
fn1 (int p)
{
  return p;
}

void
fn2 ()
{
  int f;
  d = b >= 0;
  f = (&a != &c[1]) + d;
  e = fn1 (f);
}

-- 
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/20141219/bd7956c3/attachment.html>


More information about the llvm-bugs mailing list