[llvm-bugs] [Bug 28104] New: crash on -Os and above in 32-bit mode on x86_64-linux-gnu (Incorrect LI specified for this loop)

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jun 12 23:48:35 PDT 2016


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

            Bug ID: 28104
           Summary: crash on -Os and above in 32-bit mode on
                    x86_64-linux-gnu (Incorrect LI specified for this
                    loop)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            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 3.9.0 (trunk 272512)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
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.2
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.3.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$: 
$: clang-trunk -m32 -O3 small.c
clang-3.9:
/tmp/llvm-builder/llvm-source-trunk/include/llvm/Analysis/LoopInfoImpl.h:189:
void llvm::LoopBase<N, M>::addBasicBlockToLoop(BlockT*,
llvm::LoopInfoBase<BlockT, LoopT>&) [with BlockT = llvm::MachineBasicBlock;
LoopT = llvm::MachineLoop]: Assertion `(Blocks.empty() || LIB[getHeader()] ==
this) && "Incorrect LI specified for this loop!"' failed.
#0 0x0000000001b55cc5 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1b55cc5)
#1 0x0000000001b53926 llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-3.9+0x1b53926)
#2 0x0000000001b53b51 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-3.9+0x1b53b51)
#3 0x00007f7c5488a330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007f7c53aa8c37 gsignal
/build/eglibc-oGUzwX/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f7c53aac028 abort
/build/eglibc-oGUzwX/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f7c53aa1bf6 __assert_fail_base
/build/eglibc-oGUzwX/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f7c53aa1ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x000000000159e9ae llvm::LoopBase<llvm::MachineBasicBlock,
llvm::MachineLoop>::addBasicBlockToLoop(llvm::MachineBasicBlock*,
llvm::LoopInfoBase<llvm::MachineBasicBlock, llvm::MachineLoop>&)
(/usr/local/clang-trunk/bin/clang-3.9+0x159e9ae)
#9 0x000000000169f7f4 llvm::BranchFolder::SplitMBBAt(llvm::MachineBasicBlock&,
llvm::MachineInstrBundleIterator<llvm::MachineInstr>, llvm::BasicBlock const*)
(/usr/local/clang-trunk/bin/clang-3.9+0x169f7f4)
#10 0x000000000169fd92
llvm::BranchFolder::CreateCommonTailOnlyBlock(llvm::MachineBasicBlock*&,
llvm::MachineBasicBlock*, unsigned int, unsigned int&)
(/usr/local/clang-trunk/bin/clang-3.9+0x169fd92)
#11 0x00000000016a061a
llvm::BranchFolder::TryTailMergeBlocks(llvm::MachineBasicBlock*,
llvm::MachineBasicBlock*) (/usr/local/clang-trunk/bin/clang-3.9+0x16a061a)
#12 0x00000000016a0f04
llvm::BranchFolder::TailMergeBlocks(llvm::MachineFunction&)
(/usr/local/clang-trunk/bin/clang-3.9+0x16a0f04)
#13 0x00000000016a1b6c
llvm::BranchFolder::OptimizeFunction(llvm::MachineFunction&,
llvm::TargetInstrInfo const*, llvm::TargetRegisterInfo const*,
llvm::MachineModuleInfo*, llvm::MachineLoopInfo*, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x16a1b6c)
#14 0x00000000016d8eeb (anonymous
namespace)::MachineBlockPlacement::runOnMachineFunction(llvm::MachineFunction&)
[clone .part.314] (/usr/local/clang-trunk/bin/clang-3.9+0x16d8eeb)
#15 0x0000000001581464
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1581464)
#16 0x00000000017e6403 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-3.9+0x17e6403)
#17 0x00000000017e67bb llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-3.9+0x17e67bb)
#18 0x00000000017e6acf llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-3.9+0x17e6acf)
#19 0x0000000001c8eefa clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction,
llvm::raw_pwrite_stream*) (/usr/local/clang-trunk/bin/clang-3.9+0x1c8eefa)
#20 0x0000000002262f26
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-3.9+0x2262f26)
#21 0x000000000259da0b clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x259da0b)
#22 0x00000000022632ee clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-3.9+0x22632ee)
#23 0x0000000001f91806 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-3.9+0x1f91806)
#24 0x0000000001f6cd7e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1f6cd7e)
#25 0x000000000201688c
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-3.9+0x201688c)
#26 0x0000000000a11de8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-3.9+0xa11de8)
#27 0x00000000009c4eb7 main (/usr/local/clang-trunk/bin/clang-3.9+0x9c4eb7)
#28 0x00007f7c53a93f45 __libc_start_main
/build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0
#29 0x0000000000a0dda4 _start (/usr/local/clang-trunk/bin/clang-3.9+0xa0dda4)
Stack dump:
0.    Program arguments: /usr/local/clang-trunk/bin/clang-3.9 -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
-momit-leaf-frame-pointer -dwarf-column-info -debugger-tuning=gdb -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/3.9.0 -c-isystem . -c-isystem
/usr/local/include/csmith-2.2.0/ -internal-isystem /usr/local/include
-internal-isystem /usr/local/clang-trunk/bin/../lib/clang/3.9.0/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O3
-fdebug-compilation-dir
/home/cnsun/ramdisk/reduction/20160609-clang-trunk-m32-g-O3-build-164908/delta
-ferror-limit 19 -fmessage-length 132 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o /tmp/small-d6016c.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 'Branch Probability Basic Block Placement' on function
'@main'
clang-3.9: error: unable to execute command: Aborted (core dumped)
clang-3.9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.9.0 (trunk 272512)
Target: i386-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-3.9: 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-3.9: note: diagnostic msg: 
********************

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

********************
$: 
$: cat small.c
unsigned short a, b, c;
char d;
int main() {
  unsigned e;
  int f = __builtin_printf("%d\n", a);
lbl:
  if (b) {
    __builtin_printf("%lld\n", (long long)d);
    goto lbl;
  }
  if (d < f) {
    char g = 9 >> c & a, h = (e | f) / 9;
    if (c) {
      e = d % a;
      if (!a) {
        __builtin_printf("%d\n", (int)d);
        goto lbl;
      }
      if (a > 1)
        e = h % (c * g);
      __builtin_printf("%u\n", c);
      goto lbl;
    }
  }
  e + a || b++;
  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/20160613/422da075/attachment-0001.html>


More information about the llvm-bugs mailing list