[LLVMbugs] [Bug 17936] New: clang crashes on valid code at -O1 and above in 32-bit mode (affecting all clang versions)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Nov 14 15:51:44 PST 2013


            Bug ID: 17936
           Summary: clang crashes on valid code at -O1 and above in 32-bit
                    mode (affecting all clang versions)
           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 and older versions crash when compiling the following
testcase at -O1 and above in 32-bit mode (but not 64-bit mode) on

It also appears to affect MacOS X. 

$ clang-trunk -v
clang version 3.4 (trunk 194743)
Target: x86_64-unknown-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 -m32 -O0 -c small.c
$ clang-trunk -m64 -O1 -c small.c
$ clang-trunk -m32 -O1 -c small.c
Call result #3 has unhandled type i32
UNREACHABLE executed at /tmp/llvm/lib/CodeGen/CallingConvLower.cpp:165!
0  clang           0x00000000025dede2 llvm::sys::PrintStackTrace(_IO_FILE*) +
1  clang           0x00000000025de1c9
2  libpthread.so.0 0x00007f12c1655cb0
3  libc.so.6       0x00007f12c067f425 gsignal + 53
4  libc.so.6       0x00007f12c0682b8b abort + 379
5  clang           0x00000000025c9a1c
6  clang           0x0000000001f3bfa6
const&, bool (*)(unsigned int, llvm::MVT, llvm::MVT,
llvm::CCValAssign::LocInfo, llvm::ISD::ArgFlagsTy, llvm::CCState&)) + 374
7  clang           0x0000000001c651ce
llvm::X86TargetLowering::LowerCallResult(llvm::SDValue, llvm::SDValue,
llvm::CallingConv::ID, bool, llvm::SmallVectorImpl<llvm::ISD::InputArg> const&,
llvm::SDLoc, llvm::SelectionDAG&, llvm::SmallVectorImpl<llvm::SDValue>&) const
+ 254
8  clang           0x0000000001c88569
llvm::SmallVectorImpl<llvm::SDValue>&) const + 8089
9  clang           0x0000000001da4dc5
const + 3157
10 clang           0x0000000001df817c
llvm::TargetLowering::makeLibCall(llvm::SelectionDAG&, llvm::RTLIB::Libcall,
llvm::EVT, llvm::SDValue const*, unsigned int, bool, llvm::SDLoc, bool, bool)
const + 1180
11 clang           0x0000000001ea5ac1
12 clang           0x0000000001eb7e4b
13 clang           0x0000000001e3c211
14 clang           0x0000000001e3ce93 llvm::SelectionDAG::LegalizeTypes() + 355
15 clang           0x0000000001de3e6c
llvm::SelectionDAGISel::CodeGenAndEmitDAG() + 636
16 clang           0x0000000001ded3b1
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 1777
17 clang           0x0000000001deeed8
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 1416
18 clang           0x00000000025673af
llvm::FPPassManager::runOnFunction(llvm::Function&) + 607
19 clang           0x000000000256741b
llvm::FPPassManager::runOnModule(llvm::Module&) + 43
20 clang           0x0000000002566f6f
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 927
21 clang           0x0000000000917fb2
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*,
clang::BackendAction, llvm::raw_ostream*) + 3666
22 clang           0x000000000091537d
23 clang           0x0000000000ac0e44 clang::ParseAST(clang::Sema&, bool, bool)
+ 372
24 clang           0x00000000007868da clang::FrontendAction::Execute() + 282
25 clang           0x0000000000768bf0
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 352
26 clang           0x000000000074e65d
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1693
27 clang           0x00000000007478f0 cc1_main(char const**, char const**, char
const*, void*) + 1232
28 clang           0x000000000072b029 main + 665
29 libc.so.6       0x00007f12c066a76d __libc_start_main + 237
30 clang           0x00000000007472b1
Stack dump:
0.    Program arguments: /usr/local/clang-trunk/bin/clang -cc1 -triple
i386-unknown-linux-gnu -emit-obj -disable-free -main-file-name small.c
-mrelocation-model static -fmath-errno -masm-verbose -mconstructor-aliases
-target-cpu pentium4 -target-linker-version 2.22 -momit-leaf-frame-pointer
-coverage-file /home/su/crashes/crash1/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
/include -internal-externc-isystem /usr/include -O1 -fdebug-compilation-dir
/home/su/crashes/crash1 -ferror-limit 19 -fmessage-length 96 -mstackrealign
-fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -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 'X86 DAG->DAG Instruction Selection' on function '@foo'
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
clang version 3.4 (trunk 194743)
Target: i386-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: 

Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/small-30d496.c
clang: note: diagnostic msg: /tmp/small-30d496.sh
clang: note: diagnostic msg: 



int a;
long long b, c;

void foo ()
  for (; c; c++)
    b -= a++;

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/20131114/65292e1c/attachment.html>

More information about the llvm-bugs mailing list