[LLVMbugs] [Bug 17307] New: clang segfaults at -O2 and -O3 on x86_64-pc-linux-gnu

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Sep 20 13:54:23 PDT 2013


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

            Bug ID: 17307
           Summary: clang segfaults at -O2 and -O3 on x86_64-pc-linux-gnu
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The current clang trunk segfaults when compiling the following testcase at -O2
and -O3 (in both 32-bit and 64-bit modes) on x86_64-pc-linux-gnu. 

This is a regression from clang 3.3. 


$ clang-trunk -v
clang version 3.4 (trunk 191074)
Target: x86_64-pc-linux-gnu
Thread model: posix
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.3
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
$ clang-trunk -O2 -c small.c
0  clang           0x0000000001c5e495 llvm::sys::PrintStackTrace(_IO_FILE*) +
37
1  clang           0x0000000001c5e8e3
2  libpthread.so.0 0x00007fbe7f654cb0
3  clang           0x00000000018f5d93
4  clang           0x0000000001c06edb
llvm::FPPassManager::runOnFunction(llvm::Function&) + 315
5  clang           0x0000000001a16a60
6  clang           0x0000000001c07336
llvm::MPPassManager::runOnModule(llvm::Module&) + 406
7  clang           0x0000000001c07bc0 llvm::PassManagerImpl::run(llvm::Module&)
+ 480
8  clang           0x0000000000806090
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*,
clang::BackendAction, llvm::raw_ostream*) + 5728
9  clang           0x0000000000803d1b
10 clang           0x000000000092c143 clang::ParseAST(clang::Sema&, bool, bool)
+ 531
11 clang           0x000000000080324c clang::CodeGenAction::ExecuteAction() +
76
12 clang           0x00000000006a9477 clang::FrontendAction::Execute() + 87
13 clang           0x00000000006889bd
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 813
14 clang           0x000000000067306c
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2956
15 clang           0x000000000066bea8 cc1_main(char const**, char const**, char
const*, void*) + 680
16 clang           0x00000000006715df main + 8095
17 libc.so.6       0x00007fbe7e46276d __libc_start_main + 237
18 clang           0x000000000066bb39
Stack dump:
0.    Program arguments: /usr/local/clang-trunk/bin/clang -cc1 -triple
x86_64-pc-linux-gnu -emit-obj -disable-free -disable-llvm-verifier
-main-file-name small.c -mrelocation-model static -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version
2.22 -momit-leaf-frame-pointer -coverage-file
/data2/c-hunter-results/C/trans-bugs/20130920-clang-m32-m64-O2-O3-build-test55502/small.o
-resource-dir /usr/local/clang-trunk/bin/../lib/clang/3.4 -internal-isystem
/usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/3.4/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -O2 -fdebug-compilation-dir
/data2/c-hunter-results/C/trans-bugs/20130920-clang-m32-m64-O2-O3-build-test55502
-ferror-limit 19 -fmessage-length 108 -mstackrealign -fobjc-runtime=gcc
-fobjc-default-synthesize-properties -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -o small.o -x c small.c 
1.    <eof> parser at end of file
2.    Per-module optimization passes
3.    Running pass 'CallGraph Pass Manager' on module 'small.c'.
4.    Running pass 'Global Value Numbering' on function '@bar'
clang: error: unable to execute command: Segmentation fault (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.4 (trunk 191074)
Target: x86_64-pc-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-d5412e.c
clang: note: diagnostic msg: /tmp/small-d5412e.sh
clang: note: diagnostic msg: 

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


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


int *a, e, f;
long long d[2];

int foo ()
{
  int b[1];
  a = &b[0];
  return 0;
}

int bar ()
{
  for (f = 0; f < 2; f++)
    d[f] = 1;
  e = d[0] && d[1] - foo ();
  if (e)
    return 0;
  else 
    return foo (); 
}

-- 
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/20130920/e56e97b7/attachment.html>


More information about the llvm-bugs mailing list