[LLVMbugs] [Bug 12930] New: Clang 3.1 Fails to build with a crash

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed May 23 18:45:27 PDT 2012


             Bug #: 12930
           Summary: Clang 3.1 Fails to build with a crash
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: wlynch at wlynch.cx
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 8628
  --> http://llvm.org/bugs/attachment.cgi?id=8628
C++ Source Code


This code compiles correctly on Clang 3.0, but fails on Clang 3.1. The broken
code needs to be built with -O1 atleast. I believe it only fails when the
compiler was built with optimizations on.

I'm using Linux x86_64 Centos 5. The test case also requires the boost
libraries, and I'm using version 1.49.0 of that. It uses a header only library,
so the attached preprocessed code can be used on machines that don't have it

The code is:

#include <boost/spirit/include/lex.hpp>
#include <boost/spirit/include/lex_lexertl.hpp>

typedef boost::spirit::lex::lexertl::actor_lexer<> lexer_type;

int main() {
    boost::spirit::lex::lexer<lexer_type> l;
    l.self += boost::spirit::lex::token_def<>(".") [boost::phoenix::val(1)];

When compiled under clang 3.0, there are no errors.

[8:42pm][wlynch at apple clang] /opt/llvm/3.0/bin/clang++ -c -O1 -I
/opt/boost/1.49.0/include lexer.cpp 
[8:43pm][wlynch at apple clang] echo $?

When compiled under clang 3.1, there is an ICE.

[8:43pm][wlynch at apple clang] /opt/llvm/3.1/bin/clang++ -c -O1 -I
/opt/boost/1.49.0/include lexer.cpp
clang: /tmp/llvm-3.1.src/include/llvm/CodeGen/LiveInterval.h:130:
llvm::LiveRange::LiveRange(llvm::SlotIndex, llvm::SlotIndex, llvm::VNInfo*):
Assertion `S < E && "Cannot create empty or backwards range"' failed.
0  clang           0x0000000002342abf
1  clang           0x00000000023437d7
2  libpthread.so.0 0x0000003bfbc0ebe0
3  libc.so.6       0x0000003bfac30285 gsignal + 53
4  libc.so.6       0x0000003bfac31d30 abort + 272
5  libc.so.6       0x0000003bfac29706 __assert_fail + 246
6  clang           0x0000000001ddd9a3
7  clang           0x0000000001dde3e4
8  clang           0x0000000001ddead2
9  clang           0x0000000001de237d
10 clang           0x0000000001d43bde
11 clang           0x0000000001e46754 llvm::RegAllocBase::allocatePhysRegs() +
12 clang           0x0000000001d3f15f
13 clang           0x0000000001cf0055
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 53
14 clang           0x000000000227b3a4
llvm::FPPassManager::runOnFunction(llvm::Function&) + 596
15 clang           0x000000000227b43d
llvm::FPPassManager::runOnModule(llvm::Module&) + 45
16 clang           0x000000000227aefc
llvm::MPPassManager::runOnModule(llvm::Module&) + 556
17 clang           0x000000000227b04f llvm::PassManagerImpl::run(llvm::Module&)
+ 159
18 clang           0x000000000227b13d llvm::PassManager::run(llvm::Module&) +
19 clang           0x0000000000824c5c
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*,
clang::BackendAction, llvm::raw_ostream*) + 1388
20 clang           0x00000000008221b3
21 clang           0x00000000009dd029 clang::ParseAST(clang::Sema&, bool, bool)
+ 489
22 clang           0x0000000000820382 clang::CodeGenAction::ExecuteAction() +
23 clang           0x00000000006711db
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 331
24 clang           0x00000000006510be
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1166
25 clang           0x00000000006479bf cc1_main(char const**, char const**, char
const*, void*) + 1519
26 clang           0x000000000064fe96 main + 4054
27 libc.so.6       0x0000003bfac1d994 __libc_start_main + 244
28 clang           0x0000000000645dd9
Stack dump:
0.    Program arguments: /opt/llvm/3.1/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name lexer.cpp
-mrelocation-model static -masm-verbose -mconstructor-aliases -munwind-tables
-target-cpu x86-64 -target-linker-version -momit-leaf-frame-pointer
-coverage-file lexer.o -resource-dir /opt/llvm/3.1/bin/../lib/clang/3.1 -I
/opt/boost/1.49.0/include -fmodule-cache-path /var/tmp/clang-module-cache
-internal-isystem /usr/local/include -internal-isystem
/opt/llvm/3.1/bin/../lib/clang/3.1/include -internal-externc-isystem /include
-internal-externc-isystem /usr/include -O1 -fdeprecated-macro
-fdebug-compilation-dir /tmp/clang -ferror-limit 19 -fmessage-length 238
-mstackrealign -fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak
-fobjc-fragile-abi -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o lexer.o -x c++ lexer.cpp 
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'Function Pass Manager' on module 'lexer.cpp'.
4.    Running pass 'Greedy Register Allocator' on function
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal (use -v to see
clang: note: diagnostic msg: Please submit a bug report to
http://llvm.org/bugs/ and include command line arguments and all diagnostic
clang: note: diagnostic msg: Preprocessed source(s) and associated run
script(s) are located at:
clang: note: diagnostic msg: /tmp/lexer-E56Vfc.ii
clang: note: diagnostic msg: /tmp/lexer-E56Vfc.sh

The attached bc file was produced using:

/opt/llvm/3.0/bin/clang++ -c -O1 -I /opt/boost/1.49.0/include lexer.cpp

and will fail with the same assertion when passed to llc.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list