[llvm-bugs] [Bug 25491] New: clang crashes on valid code at -Os and above on x86_64-linux-gnu

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 11 08:54:27 PST 2015


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

            Bug ID: 25491
           Summary: clang crashes on valid code at -Os 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: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The current clang trunk crashes when compiling the following test case on
x86_64-linux-gnu at -Os and above in both 32-bit and 64-bit modes.

It also affects 3.1 and later (3.1 hangs instead of crashing). 

It is thus a regression from 3.0. 


$ clang-trunk -v
clang version 3.8.0 (trunk 252640)
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 -O1 -c small.c
$ clang-3.0 -Os -c small.c
$ 
$ timeout -s 9 30 clang-3.1 -Os -c small.c
Killed
$ 
$ clang-trunk -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 0x0000000003107ec5 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang+0x3107ec5)
#1 0x0000000003105936 llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang+0x3105936)
#2 0x0000000003105b46 (/usr/local/clang-trunk/bin/clang+0x3105b46)
#3 0x00007f68338f9340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007f6832894cc9 gsignal
/build/buildd/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f68328980d8 abort /build/buildd/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f683288db86 __assert_fail_base
/build/buildd/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f683288dc32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x000000000293c627
llvm::ScheduleDAGTopologicalSort::InitDAGTopologicalSorting()
(/usr/local/clang-trunk/bin/clang+0x293c627)
#9 0x00000000027317df (/usr/local/clang-trunk/bin/clang+0x27317df)
#10 0x00000000026bf5e4 llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(/usr/local/clang-trunk/bin/clang+0x26bf5e4)
#11 0x00000000026c81ed
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/usr/local/clang-trunk/bin/clang+0x26c81ed)
#12 0x00000000026ca03f
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/usr/local/clang-trunk/bin/clang+0x26ca03f)
#13 0x0000000002483c54 (/usr/local/clang-trunk/bin/clang+0x2483c54)
#14 0x0000000003073aef llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang+0x3073aef)
#15 0x0000000003073b2b llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang+0x3073b2b)
#16 0x00000000030757c7 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang+0x30757c7)
#17 0x0000000000bb3548 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+0xbb3548)
#18 0x0000000000b90c38 (/usr/local/clang-trunk/bin/clang+0xb90c38)
#19 0x0000000000df5832 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang+0xdf5832)
#20 0x0000000000b93732 clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang+0xb93732)
#21 0x0000000000980536 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang+0x980536)
#22 0x0000000000955bae
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang+0x955bae)
#23 0x0000000000936e9c
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang+0x936e9c)
#24 0x000000000092ecb0 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang+0x92ecb0)
#25 0x0000000000914648 main (/usr/local/clang-trunk/bin/clang+0x914648)
#26 0x00007f683287fec5 __libc_start_main
/build/buildd/eglibc-2.19/csu/libc-start.c:321:0
#27 0x000000000092d33d _start (/usr/local/clang-trunk/bin/clang+0x92d33d)
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 -mthread-model posix -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-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
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -Os -fdebug-compilation-dir /data2
-ferror-limit 19 -fmessage-length 174 -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 '@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.8.0 (trunk 252640)
Target: x86_64-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-477c6a.c
clang: note: diagnostic msg: /tmp/small-477c6a.sh
clang: note: diagnostic msg: 

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


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


short a;
volatile int b, c;

int
fn1 (int p1, int p2)
{
  return p2 ? p1 % p2 : p1; 
}

void
fn2 ()
{
  c = fn1 (b, ++a || 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/20151111/b5d4b253/attachment.html>


More information about the llvm-bugs mailing list