[llvm-bugs] [Bug 37916] New: clang crashes with "-mllvm -enable-newgvn": Assertion `N->getNodeId() == -1 && "Node already inserted!"' failed.

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jun 24 10:53:53 PDT 2018


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

            Bug ID: 37916
           Summary: clang crashes with "-mllvm -enable-newgvn": Assertion
                    `N->getNodeId() == -1 && "Node already inserted!"'
                    failed.
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: helloqirun at gmail.com
                CC: llvm-bugs at lists.llvm.org

It happens in 32-bit mode only.

$ clang-trunk -v
clang version 7.0.0 (trunk 335429)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin


$ clang-trunk -mllvm -enable-newgvn abc.c -m32 -O2
abc.c:20:5: warning: expression result unused [-Wunused-value]
    (j -= *f && a) ?: (c = b);
    ^~~~~~~~~~~~~~~~~~~~~~~~~
clang-7:
/home/absozero/trunk/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp:1022:
llvm::SUnit *(anonymous namespace)::ScheduleDAGRRList::TryUnfoldSU(llvm::SUnit
*): Assertion `N->getNodeId() == -1 && "Node already inserted!"' failed.
Stack dump:
0.      Program arguments: /home/absozero/trunk/root-clang/bin/clang-7 -cc1
-triple i386-unknown-linux-gnu -emit-obj -disable-free -main-file-name abc.c
-mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose
-mconstructor-aliases -fuse-init-array -target-cpu pentium4 -dwarf-column-info
-debugger-tuning=gdb -momit-leaf-frame-pointer -resource-dir
/home/absozero/trunk/root-clang/lib/clang/7.0.0 -internal-isystem
/usr/local/include -internal-isystem
/home/absozero/trunk/root-clang/lib/clang/7.0.0/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O2
-fdebug-compilation-dir /home/absozero/projects/reduction/crash -ferror-limit
19 -fmessage-length 162 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -mllvm -enable-newgvn -o
/tmp/abc-f8c0c4.o -x c abc.c
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'abc.c'.
4.      Running pass 'X86 DAG->DAG Instruction Selection' on function '@fn1'
#0 0x0000000002093714 PrintStackTraceSignalHandler(void*)
(/home/absozero/trunk/root-clang/bin/clang-7+0x2093714)
#1 0x000000000209166e llvm::sys::RunSignalHandlers()
(/home/absozero/trunk/root-clang/bin/clang-7+0x209166e)
#2 0x00000000020938d2 SignalHandler(int)
(/home/absozero/trunk/root-clang/bin/clang-7+0x20938d2)
#3 0x00007f2c0c8b2330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007f2c0b48dc37 gsignal
/build/eglibc-ripdx6/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f2c0b491028 abort
/build/eglibc-ripdx6/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f2c0b486bf6 __assert_fail_base
/build/eglibc-ripdx6/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f2c0b486ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x0000000002b35b9f (anonymous
namespace)::ScheduleDAGRRList::PickNodeToScheduleBottomUp()
(/home/absozero/trunk/root-clang/bin/clang-7+0x2b35b9f)
#9 0x0000000002b3164d (anonymous namespace)::ScheduleDAGRRList::Schedule()
(/home/absozero/trunk/root-clang/bin/clang-7+0x2b3164d)
#10 0x0000000002abae6a llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(/home/absozero/trunk/root-clang/bin/clang-7+0x2abae6a)
#11 0x0000000002ab7cf6
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/home/absozero/trunk/root-clang/bin/clang-7+0x2ab7cf6)
#12 0x0000000002ab3b6b
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/home/absozero/trunk/root-clang/bin/clang-7+0x2ab3b6b)
#13 0x0000000001360cc1 (anonymous
namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/home/absozero/trunk/root-clang/bin/clang-7+0x1360cc1)
#14 0x0000000001806208
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/home/absozero/trunk/root-clang/bin/clang-7+0x1806208)
#15 0x0000000001b5e326 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/absozero/trunk/root-clang/bin/clang-7+0x1b5e326)
#16 0x0000000001b5e5f3 llvm::FPPassManager::runOnModule(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-7+0x1b5e5f3)
#17 0x0000000001b5eb50 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang-7+0x1b5eb50)
#18 0x0000000002259b7d 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/absozero/trunk/root-clang/bin/clang-7+0x2259b7d)
#19 0x0000000002b85cb0
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/absozero/trunk/root-clang/bin/clang-7+0x2b85cb0)
#20 0x0000000003117a84 clang::ParseAST(clang::Sema&, bool, bool)
(/home/absozero/trunk/root-clang/bin/clang-7+0x3117a84)
#21 0x00000000026fc7a0 clang::FrontendAction::Execute()
(/home/absozero/trunk/root-clang/bin/clang-7+0x26fc7a0)
#22 0x00000000026a5ab1
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/absozero/trunk/root-clang/bin/clang-7+0x26a5ab1)
#23 0x00000000027a1279
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/absozero/trunk/root-clang/bin/clang-7+0x27a1279)
#24 0x00000000009163e8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/absozero/trunk/root-clang/bin/clang-7+0x9163e8)
#25 0x0000000000913d2f main
(/home/absozero/trunk/root-clang/bin/clang-7+0x913d2f)
#26 0x00007f2c0b478f45 __libc_start_main
/build/eglibc-ripdx6/eglibc-2.19/csu/libc-start.c:321:0
#27 0x0000000000910dbd _start
(/home/absozero/trunk/root-clang/bin/clang-7+0x910dbd)
clang-7: error: unable to execute command: Aborted (core dumped)
clang-7: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 7.0.0 (trunk 335429)
Target: i386-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-7: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang-7: note: diagnostic msg:
********************

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

********************


$ cat abc.c
long long a;
long b, g, h;
short c;
char d;
int e;
long long *f;
void fn1() {
  short i;
  if (f) {
    for (; h;)
    l1:;
    for (; g;)
      ;
  }
  if (e) {
    int j = 0;
    f = &a;
    for (; i <= 8; i++)
    l2:;
    (j -= *f && a) ?: (c = b);
    d = j;
    i = 8;
    goto l1;
  }
  if (i)
    ;
  else
    goto l2;
}

-- 
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/20180624/32e980b0/attachment.html>


More information about the llvm-bugs mailing list