[llvm-bugs] [Bug 25623] New: clang crashes on valid code at -Os and above on x86_64-linux-gnu in 32-bit mode

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 24 06:27:54 PST 2015


https://llvm.org/bugs/show_bug.cgi?id=25623

            Bug ID: 25623
           Summary: clang crashes on valid code at -Os and above on
                    x86_64-linux-gnu in 32-bit mode
           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: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The current clang trunk and 3.7.x crash when compiling the following test case
on x86_64-linux-gnu at -Os and above in the 32-bit mode (but not in 64-bit
mode).

This is a regression from 3.6.x. 


$ clang-trunk -v
clang version 3.8.0 (trunk 253832)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/tools/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.2
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.1.0
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.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.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.1.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$
$ clang-trunk -m32 -O1 -c small.c
$ clang-trunk -m64 -Os -c small.c
$ clang-3.6.0 -m32 -Os -c small.c
$
$ clang-trunk -m32 -Os -c small.c
clang: /tmp/llvm/lib/CodeGen/ScheduleDAG.cpp:510: void
llvm::ScheduleDAGTopologicalSort::InitDAGTopologicalSorting(): Assertion
`Node2Index[SU->NodeNum] > Node2Index[I->getSUnit()->NodeNum] && "Wrong
topological sorting"' failed.
#0 0x000000000313b2e5 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang+0x313b2e5)
#1 0x0000000003138d56 llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang+0x3138d56)
#2 0x0000000003138f66 (/usr/local/clang-trunk/bin/clang+0x3138f66)
#3 0x00007fbf583ec340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007fbf57387cc9 gsignal
/build/buildd/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007fbf5738b0d8 abort /build/buildd/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007fbf57380b86 __assert_fail_base
/build/buildd/eglibc-2.19/assert/assert.c:92:0
#7 0x00007fbf57380c32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x000000000296ab77
llvm::ScheduleDAGTopologicalSort::InitDAGTopologicalSorting()
(/usr/local/clang-trunk/bin/clang+0x296ab77)
#9 0x000000000275d8ef (/usr/local/clang-trunk/bin/clang+0x275d8ef)
#10 0x00000000026ec7c4 llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(/usr/local/clang-trunk/bin/clang+0x26ec7c4)
#11 0x00000000026f5361
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/usr/local/clang-trunk/bin/clang+0x26f5361)
#12 0x00000000026f71bf
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/usr/local/clang-trunk/bin/clang+0x26f71bf)
#13 0x00000000024ae184 (/usr/local/clang-trunk/bin/clang+0x24ae184)
#14 0x00000000030a73ff llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang+0x30a73ff)
#15 0x00000000030a743b llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang+0x30a743b)
#16 0x00000000030a9007 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang+0x30a9007)
#17 0x0000000000bc0178 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::StringRef, llvm::Module*, clang::BackendAction,
llvm::raw_pwrite_stream*) (/usr/local/clang-trunk/bin/clang+0xbc0178)
#18 0x0000000000b9c208 (/usr/local/clang-trunk/bin/clang+0xb9c208)
#19 0x0000000000e03952 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang+0xe03952)
#20 0x0000000000b9ed22 clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang+0xb9ed22)
#21 0x0000000000983fa6 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang+0x983fa6)
#22 0x000000000095926e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang+0x95926e)
#23 0x000000000093a4ac
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang+0x93a4ac)
#24 0x00000000009322c0 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang+0x9322c0)
#25 0x00000000009184e8 main (/usr/local/clang-trunk/bin/clang+0x9184e8)
#26 0x00007fbf57372ec5 __libc_start_main
/build/buildd/eglibc-2.19/csu/libc-start.c:321:0
#27 0x000000000093094d _start (/usr/local/clang-trunk/bin/clang+0x93094d)
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 -mthread-model posix -fmath-errno -masm-verbose
-mconstructor-aliases -fuse-init-array -target-cpu pentium4
-target-linker-version 2.24 -momit-leaf-frame-pointer -dwarf-column-info
-coverage-file /data2/small.c -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/3.8.0 -internal-isystem
/usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/3.8.0/include -internal-externc-isystem
/include -internal-externc-isystem /usr/include -Os -fdebug-compilation-dir
/data2 -ferror-limit 19 -fmessage-length 109 -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 'X86 DAG->DAG Instruction Selection' on function '@fn1'
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.8.0 (trunk 253832)
Target: i386-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/tools/bin
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-af7540.c
clang: note: diagnostic msg: /tmp/small-af7540.sh
clang: note: diagnostic msg:

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


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


volatile int a = 1, d;
long b;
long long c, e, f;

void
fn1 ()
{ 
  int g = (a || e) - c, h = g / a;
  long long i = c + b;
  d = h;
  f = i;
}

-- 
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/20151124/9b30bd62/attachment-0001.html>


More information about the llvm-bugs mailing list