[llvm-bugs] [Bug 36312] New: clang crashes at -O1 and above: Assertion `Node2Index[SU.NodeNum] > Node2Index[PD.getSUnit()->NodeNum] && "Wrong topological sorting"' failed

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Feb 8 22:45:36 PST 2018


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

            Bug ID: 36312
           Summary: clang crashes at -O1 and above: Assertion
                    `Node2Index[SU.NodeNum] >
                    Node2Index[PD.getSUnit()->NodeNum] && "Wrong
                    topological sorting"' failed
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: llvm-bugs at lists.llvm.org

Tested with trunk revision 324696. 

$ clangpolly -v
clang version 7.0.0 (http://llvm.org/git/clang.git
4d259cd5974c3927ca86d9b61bb9be2d6739913f) (http://llvm.org/git/llvm.git
5aa15f49a2933afc58166d0e1c976cb5e586f1c8)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/su/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6.0.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.4
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.5
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.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ 
$ clangpolly -O0 -c small.c
$ 
$ clangpolly -O1 -c small.c
clang-6.0: /home/su/software/tmp/polly/llvm/lib/CodeGen/ScheduleDAG.cpp:518:
void llvm::ScheduleDAGTopologicalSort::InitDAGTopologicalSorting(): Assertion
`Node2Index[SU.NodeNum] > Node2Index[PD.getSUnit()->NodeNum] && "Wrong
topological sorting"' failed.
#0 0x00000000021805ca llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/su/software/tmp/polly/llvm/lib/Support/Unix/Signals.inc:402:0
#1 0x000000000217e45e llvm::sys::RunSignalHandlers()
/home/su/software/tmp/polly/llvm/lib/Support/Signals.cpp:50:0
#2 0x000000000217e5d2 SignalHandler(int)
/home/su/software/tmp/polly/llvm/lib/Support/Unix/Signals.inc:242:0
#3 0x00007f4726576390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#4 0x00007f47252e8428 gsignal
/build/glibc-bfm8X4/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
#5 0x00007f47252ea02a abort /build/glibc-bfm8X4/glibc-2.23/stdlib/abort.c:91:0
#6 0x00007f47252e0bd7 __assert_fail_base
/build/glibc-bfm8X4/glibc-2.23/assert/assert.c:92:0
#7 0x00007f47252e0c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#8 0x0000000001a840a5
llvm::BitVector::init_words(llvm::MutableArrayRef<unsigned long>, bool)
/home/su/software/tmp/polly/llvm/include/llvm/ADT/BitVector.h:877:0
#9 0x0000000001a840a5 llvm::BitVector::set_unused_bits(bool)
/home/su/software/tmp/polly/llvm/include/llvm/ADT/BitVector.h:849:0
#10 0x0000000001a840a5 llvm::BitVector::clear_unused_bits()
/home/su/software/tmp/polly/llvm/include/llvm/ADT/BitVector.h:864:0
#11 0x0000000001a840a5 llvm::BitVector::resize(unsigned int, bool)
/home/su/software/tmp/polly/llvm/include/llvm/ADT/BitVector.h:389:0
#12 0x0000000001a840a5
llvm::ScheduleDAGTopologicalSort::InitDAGTopologicalSorting()
/home/su/software/tmp/polly/llvm/lib/CodeGen/ScheduleDAG.cpp:511:0
#13 0x0000000002b2fe49 (anonymous namespace)::ScheduleDAGRRList::Schedule()
/home/su/software/tmp/polly/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:371:0
#14 0x0000000002abf5c6 llvm::TimeRegion::~TimeRegion()
/home/su/software/tmp/polly/llvm/include/llvm/Support/Timer.h:152:0
#15 0x0000000002abf5c6 llvm::NamedRegionTimer::~NamedRegionTimer()
/home/su/software/tmp/polly/llvm/include/llvm/Support/Timer.h:160:0
#16 0x0000000002abf5c6 llvm::SelectionDAGISel::CodeGenAndEmitDAG()
/home/su/software/tmp/polly/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:883:0
#17 0x0000000002ac484a
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
/home/su/software/tmp/polly/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1632:0
#18 0x0000000002ac67b9
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) [clone
.part.853] [clone .constprop.875]
/home/su/software/tmp/polly/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:467:0
#19 0x0000000001511614 (anonymous
namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
/home/su/software/tmp/polly/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:177:0
#20 0x000000000197dbc5
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
/home/su/software/tmp/polly/llvm/lib/CodeGen/MachineFunctionPass.cpp:62:0
#21 0x0000000001cb059b llvm::FPPassManager::runOnFunction(llvm::Function&)
/home/su/software/tmp/polly/llvm/lib/IR/LegacyPassManager.cpp:1520:0
#22 0x0000000001cb065c llvm::FPPassManager::runOnModule(llvm::Module&)
/home/su/software/tmp/polly/llvm/lib/IR/LegacyPassManager.cpp:1541:0
#23 0x0000000001cb019d llvm::legacy::PassManagerImpl::run(llvm::Module&)
/home/su/software/tmp/polly/llvm/lib/IR/LegacyPassManager.cpp:1597:0
#24 0x000000000233b642 llvm::PrettyStackTraceString::~PrettyStackTraceString()
/home/su/software/tmp/polly/llvm/include/llvm/Support/PrettyStackTrace.h:52:0
#25 0x000000000233b642 EmitAssembly
/home/su/software/tmp/polly/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp:806:0
#26 0x000000000233b642 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
/home/su/software/tmp/polly/llvm/tools/clang/lib/CodeGen/BackendUtil.cpp:1180:0
#27 0x0000000002b82767 std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >::~unique_ptr()
/usr/include/c++/5/bits/unique_ptr.h:235:0
#28 0x0000000002b82767
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
/home/su/software/tmp/polly/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:292:0
#29 0x0000000002d57ba8 void std::swap<bool>(bool&, bool&)
/usr/include/c++/5/bits/move.h:187:0
#30 0x0000000002d57ba8 clang::ParseAST(clang::Sema&, bool, bool)
/home/su/software/tmp/polly/llvm/tools/clang/lib/Parse/ParseAST.cpp:161:0
#31 0x0000000002b81bff clang::CodeGenAction::ExecuteAction()
/home/su/software/tmp/polly/llvm/tools/clang/lib/CodeGen/CodeGenAction.cpp:1032:0
#32 0x000000000270716e clang::FrontendAction::Execute()
/home/su/software/tmp/polly/llvm/tools/clang/lib/Frontend/FrontendAction.cpp:904:0
#33 0x00000000026d66c6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/home/su/software/tmp/polly/llvm/tools/clang/lib/Frontend/CompilerInstance.cpp:992:0
#34 0x0000000002796d42
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/home/su/software/tmp/polly/llvm/tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:252:0
#35 0x0000000000ab7e88 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*)
/home/su/software/tmp/polly/llvm/tools/clang/tools/driver/cc1_main.cpp:221:0
#36 0x0000000000a2d050 ExecuteCC1Tool
/home/su/software/tmp/polly/llvm/tools/clang/tools/driver/driver.cpp:309:0
#37 0x0000000000a2d050 main
/home/su/software/tmp/polly/llvm/tools/clang/tools/driver/driver.cpp:389:0
#38 0x00007f47252d3830 __libc_start_main
/build/glibc-bfm8X4/glibc-2.23/csu/../csu/libc-start.c:325:0
#39 0x0000000000ab42b9 _start
(/home/su/software/tmp/polly/llvm_build/bin/clang-6.0+0xab42b9)
Stack dump:
0.      Program arguments: /home/su/software/tmp/polly/llvm_build/bin/clang-6.0
-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 -dwarf-column-info -debugger-tuning=gdb
-momit-leaf-frame-pointer -coverage-notes-file /home/su/small.gcno
-resource-dir /home/su/software/tmp/polly/llvm_build/lib/clang/7.0.0
-internal-isystem /usr/local/include -internal-isystem
/home/su/software/tmp/polly/llvm_build/lib/clang/7.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O1
-fdebug-compilation-dir /home/su -ferror-limit 19 -fmessage-length 163
-fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -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 '@g'
clang-6.0: error: unable to execute command: Aborted (core dumped)
clang-6.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 7.0.0 (http://llvm.org/git/clang.git
4d259cd5974c3927ca86d9b61bb9be2d6739913f) (http://llvm.org/git/llvm.git
5aa15f49a2933afc58166d0e1c976cb5e586f1c8)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/su/bin
clang-6.0: 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-6.0: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-6.0: note: diagnostic msg: /tmp/small-520263.c
clang-6.0: note: diagnostic msg: /tmp/small-520263.sh
clang-6.0: note: diagnostic msg: 

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


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


int a, b;

struct
{
  int x;
  int y;
} c, *d = &c;

void g ()
{
  int f = 1;
  a = d->y;
  a += (++b && f);
}

-- 
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/20180209/b3801d53/attachment.html>


More information about the llvm-bugs mailing list