[LLVMbugs] [Bug 20314] New: clang crashes on valid code at -O1 and above on x86_64-linux-gnu

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 15 17:10:09 PDT 2014


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

            Bug ID: 20314
           Summary: clang crashes on valid code at -O1 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 testcase at -O1
and above in both 32-bit and 64-bit modes on x86_64-linux-gnu. 

This is a regression from clang 3.4.x.

$ clang-trunk -v
clang version 3.5.0 (trunk 213018)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8.1
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.6
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.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 -O0 small.c; a.out
$ clang-3.4 -O1 small.c; a.out
$ 
$ clang-trunk -O1 small.c
clang: /tmp/llvm/include/llvm/Support/Casting.h:237: typename cast_retty<X, Y
*>::ret_type llvm::cast(Y *) [X = llvm::Instruction, Y = llvm::User]: Assertion
`isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
0  clang           0x000000000274b8e5 llvm::sys::PrintStackTrace(_IO_FILE*) +
37
1  clang           0x000000000274c0d3
2  libpthread.so.0 0x00007eff679e6cb0
3  libc.so.6       0x00007eff66804425 gsignal + 53
4  libc.so.6       0x00007eff66807b8b abort + 379
5  libc.so.6       0x00007eff667fd0ee
6  libc.so.6       0x00007eff667fd192
7  clang           0x00000000020a9869
8  clang           0x00000000020a7827
9  clang           0x00000000020a9d70
10 clang           0x00000000020a8ea2
11 clang           0x00000000020a7827
12 clang           0x00000000020a429d
13 clang           0x00000000020a17e7
14 clang           0x000000000209fb70
15 clang           0x000000000268301b
llvm::FPPassManager::runOnFunction(llvm::Function&) + 539
16 clang           0x000000000268328b
llvm::FPPassManager::runOnModule(llvm::Module&) + 43
17 clang           0x0000000002683807
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 967
18 clang           0x00000000008b81fd
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&,
llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_ostream*) +
7293
19 clang           0x00000000008b591a
20 clang           0x0000000000aa0143 clang::ParseAST(clang::Sema&, bool, bool)
+ 467
21 clang           0x00000000006debde clang::FrontendAction::Execute() + 62
22 clang           0x00000000006b3703
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 867
23 clang           0x0000000000696050
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3104
24 clang           0x000000000068cbd9 cc1_main(char const**, char const**, char
const*, void*) + 665
25 clang           0x0000000000693cf6 main + 9158
26 libc.so.6       0x00007eff667ef76d __libc_start_main + 237
27 clang           0x000000000068c859
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 -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 -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/3.5.0 -internal-isystem
/usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/3.5.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -O1 -fdebug-compilation-dir
/data2/c-hunter-results/C/trans-bugs/REDUCED/20140715-clang-m32-m64-O1-build-test152605
-ferror-limit 19 -fmessage-length 113 -mstackrealign -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -o /tmp/small-7481ed.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.5.0 (trunk 213018)
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-684837.c
clang: note: diagnostic msg: /tmp/small-684837.sh
clang: note: diagnostic msg: 

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


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


int a, c[2], e; 
static char b[2] = { 1, 0 }, d; 

int
fn1 (int p)
{
  return p;
}

void
fn2 ()
{
  int *f = &c[1], *g = &a;
  d = 1;
  for (e = 0; e < 1; e++)
    if (!fn1 (b[d]))
      {
    d |= f == g;
    *f = b[d];
      }
}

int
main ()
{
  fn2 (); 
  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/20140716/7d40df72/attachment.html>


More information about the llvm-bugs mailing list