[llvm-bugs] [Bug 31117] New: crash on valid C code at -Os and above in both 32-bit and 64-bit modes on x86_64-linux-gnu (Assertion `Headers.size() >= 2 && "Expected irreducible CFG; -loop-info is likely invalid"' failed.)

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 22 10:59:23 PST 2016


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

            Bug ID: 31117
           Summary: crash on valid C code at -Os and above in both 32-bit
                    and 64-bit modes on x86_64-linux-gnu (Assertion
                    `Headers.size() >= 2 && "Expected irreducible CFG;
                    -loop-info is likely invalid"' failed.)
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: chengniansun at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

$ clang-trunk -v
clang version 4.0.0 (trunk 287646)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
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.3.0
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$
$ clang-trunk -O3 small.c -w
clang-4.0:
/tmp/llvm-builder/llvm-source-trunk/lib/Analysis/BlockFrequencyInfoImpl.cpp:670:
void findIrreducibleHeaders(const llvm::BlockFrequencyInfoImplBase&, const
llvm::bfi_detail::IrreducibleGraph&, const std::vector<const
llvm::bfi_detail::IrreducibleGraph::IrrNode*>&,
llvm::BlockFrequencyInfoImplBase::LoopData::NodeList&,
llvm::BlockFrequencyInfoImplBase::LoopData::NodeList&): Assertion
`Headers.size() >= 2 && "Expected irreducible CFG; -loop-info is likely
invalid"' failed.
#0 0x0000000001d1c425 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1d1c425)
#1 0x0000000001d1a3fe llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-4.0+0x1d1a3fe)
#2 0x0000000001d1a562 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-4.0+0x1d1a562)
#3 0x00007f02b50b6340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007f02b3ea7cc9 gsignal
/build/eglibc-3GlaMS/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f02b3eab0d8 abort
/build/eglibc-3GlaMS/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f02b3ea0b86 __assert_fail_base
/build/eglibc-3GlaMS/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f02b3ea0c32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x00000000026348d8
llvm::BlockFrequencyInfoImplBase::analyzeIrreducible(llvm::bfi_detail::IrreducibleGraph
const&, llvm::BlockFrequencyInfoImplBase::LoopData*,
std::_List_iterator<llvm::BlockFrequencyInfoImplBase::LoopData>)
(/usr/local/clang-trunk/bin/clang-4.0+0x26348d8)
#9 0x000000000262a8d4
llvm::BlockFrequencyInfoImpl<llvm::BasicBlock>::calculate(llvm::Function
const&, llvm::BranchProbabilityInfo const&, llvm::LoopInfo const&)
(/usr/local/clang-trunk/bin/clang-4.0+0x262a8d4)
#10 0x000000000262af90 llvm::BlockFrequencyInfo::calculate(llvm::Function
const&, llvm::BranchProbabilityInfo const&, llvm::LoopInfo const&)
(/usr/local/clang-trunk/bin/clang-4.0+0x262af90)
#11 0x000000000163f0c2 (anonymous
namespace)::CodeGenPrepare::eliminateMostlyEmptyBlocks(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-4.0+0x163f0c2)
#12 0x0000000001646690 (anonymous
namespace)::CodeGenPrepare::runOnFunction(llvm::Function&) [clone .part.1072]
(/usr/local/clang-trunk/bin/clang-4.0+0x1646690)
#13 0x0000000001984663 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1984663)
#14 0x000000000198470c llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-4.0+0x198470c)
#15 0x000000000198500f llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-4.0+0x198500f)
#16 0x0000000001e87c7a (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/usr/local/clang-trunk/bin/clang-4.0+0x1e87c7a)
#17 0x0000000001e89ab5 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
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> >)
(/usr/local/clang-trunk/bin/clang-4.0+0x1e89ab5)
#18 0x00000000024adedb
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-4.0+0x24adedb)
#19 0x00000000028a34b2 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x28a34b2)
#20 0x00000000024a90af clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-4.0+0x24a90af)
#21 0x00000000021b82d6 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-4.0+0x21b82d6)
#22 0x0000000002192466
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-4.0+0x2192466)
#23 0x000000000224120a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-4.0+0x224120a)
#24 0x0000000000ab6758 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-4.0+0xab6758)
#25 0x0000000000a58e29 main (/usr/local/clang-trunk/bin/clang-4.0+0xa58e29)
#26 0x00007f02b3e92ec5 __libc_start_main
/build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0
#27 0x0000000000ab279e _start (/usr/local/clang-trunk/bin/clang-4.0+0xab279e)
Stack dump:
0.      Program arguments: /usr/local/clang-trunk/bin/clang-4.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
-momit-leaf-frame-pointer -dwarf-column-info -debugger-tuning=gdb -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/4.0.0 -c-isystem . -c-isystem
/usr/local/include/csmith -c-isystem /usr/local/include/csmith -c-isystem
/usr/local/include/csmith -internal-isystem /usr/local/include
-internal-isystem /usr/local/clang-trunk/bin/../lib/clang/4.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O3
-w -fdebug-compilation-dir
/home/cnsun/ramdisk/hermes/run-2/res/20161121-clang-trunk-m64-Weverything-g-O3-build-111528/delta
-ferror-limit 19 -fmessage-length 238 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o /tmp/small-4ea534.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 'CodeGen Prepare' on function '@main'
clang-4.0: error: unable to execute command: Aborted (core dumped)
clang-4.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 4.0.0 (trunk 287646)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
clang-4.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-4.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-4.0: note: diagnostic msg: /tmp/small-04d5b5.c
clang-4.0: note: diagnostic msg: /tmp/small-04d5b5.sh
clang-4.0: note: diagnostic msg:

********************
$
$ cat small.c
int a, b, e, f, g, l;
short c, i;
char d, m;
void fn1(p1) {
  for (; e;) {
  L1:
    ;
    short j;
    {
    L2:
      ;
      int k = printf("%d\n", g);
      if (k)
        goto L1;
      if (i)
        goto L2;
    }
  }
}

char fn2() {
  m = c;
  return l;
}

char fn3() {
  int h;
  if (!f)
    f = h = 30;
  for (; h; h = a)
    fn1(b || fn2());
  return d;
}

int main() {
  if (b | fn3())
    e;
  return 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/20161122/97bccdf0/attachment.html>


More information about the llvm-bugs mailing list