[llvm-bugs] [Bug 33363] New: crash with "-O3 -m32" on x86_64-linux-gnu (Assertion `SA->getUseBlocks().size() == 1 && "Not a local interval"' failed.)

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 8 11:47:59 PDT 2017


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

            Bug ID: 33363
           Summary: crash with "-O3 -m32" on x86_64-linux-gnu (Assertion
                    `SA->getUseBlocks().size() == 1 && "Not a local
                    interval"' failed.)
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: chengniansun at gmail.com
                CC: llvm-bugs at lists.llvm.org

$ clang-trunk -v
clang version 5.0.0 (trunk 304921)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
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.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.4
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/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-5.0:
/tmp/llvm-builder/llvm-source-trunk/lib/CodeGen/RegAllocGreedy.cpp:1779:
unsigned int {anonymous}::RAGreedy::tryLocalSplit(llvm::LiveInterval&,
llvm::AllocationOrder&, llvm::SmallVectorImpl<unsigned int>&): Assertion
`SA->getUseBlocks().size() == 1 && "Not a local interval"' failed.
#0 0x00000000020a76ea llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-5.0+0x20a76ea)
#1 0x00000000020a56fe llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-5.0+0x20a56fe)
#2 0x00000000020a5862 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-5.0+0x20a5862)
#3 0x00007f5a2a8bf330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007f5a296adc37 gsignal
/build/eglibc-MjiXCM/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f5a296b1028 abort
/build/eglibc-MjiXCM/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f5a296a6bf6 __assert_fail_base
/build/eglibc-MjiXCM/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f5a296a6ca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x0000000001b78733 (anonymous
namespace)::RAGreedy::tryLocalSplit(llvm::LiveInterval&,
llvm::AllocationOrder&, llvm::SmallVectorImpl<unsigned int>&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1b78733)
#9 0x0000000001b7bd69 (anonymous
namespace)::RAGreedy::selectOrSplitImpl(llvm::LiveInterval&,
llvm::SmallVectorImpl<unsigned int>&, llvm::SmallSet<unsigned int, 16u,
std::less<unsigned int> >&, unsigned int)
(/usr/local/clang-trunk/bin/clang-5.0+0x1b7bd69)
#10 0x0000000001b7dc9b (anonymous
namespace)::RAGreedy::selectOrSplit(llvm::LiveInterval&,
llvm::SmallVectorImpl<unsigned int>&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1b7dc9b)
#11 0x0000000001bb55cd llvm::RegAllocBase::allocatePhysRegs()
(/usr/local/clang-trunk/bin/clang-5.0+0x1bb55cd)
#12 0x0000000001b79e67 (anonymous
namespace)::RAGreedy::runOnMachineFunction(llvm::MachineFunction&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1b79e67)
#13 0x0000000001991ce5
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1991ce5)
#14 0x0000000001c6f373 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1c6f373)
#15 0x0000000001c6f41c llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1c6f41c)
#16 0x0000000001c7016f llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1c7016f)
#17 0x000000000222f12e (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-5.0+0x222f12e)
#18 0x00000000022304b1 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> >)
(/usr/local/clang-trunk/bin/clang-5.0+0x22304b1)
#19 0x00000000028e288b
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-5.0+0x28e288b)
#20 0x0000000002cce0b2 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-5.0+0x2cce0b2)
#21 0x00000000028e1f5f clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-5.0+0x28e1f5f)
#22 0x00000000025ae746 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-5.0+0x25ae746)
#23 0x0000000002588476
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-5.0+0x2588476)
#24 0x000000000263b864
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-5.0+0x263b864)
#25 0x0000000000c18f78 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-5.0+0xc18f78)
#26 0x0000000000bb7f87 main (/usr/local/clang-trunk/bin/clang-5.0+0xbb7f87)
#27 0x00007f5a29698f45 __libc_start_main
/build/eglibc-MjiXCM/eglibc-2.19/csu/libc-start.c:321:0
#28 0x0000000000c14889 _start (/usr/local/clang-trunk/bin/clang-5.0+0xc14889)
Stack dump:
0.      Program arguments: /usr/local/clang-trunk/bin/clang-5.0 -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/lib/clang/5.0.0 -c-isystem . -c-isystem
/usr/local/include/csmith-2.2.0/ -c-isystem /usr/local/include/csmith-2.2.0/
-internal-isystem /usr/local/include -internal-isystem
/usr/local/clang-trunk/lib/clang/5.0.0/include -internal-externc-isystem
/include -internal-externc-isystem /usr/include -O3 -fdebug-compilation-dir
/home/cnsun/ramdisk/hermes/run-9/res/20170607-clang-trunk-m32-Weverything-g-O3-build-123015/delta
-ferror-limit 19 -fmessage-length 238 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o /tmp/small-05e73d.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 'Greedy Register Allocator' on function '@main'
clang-5.0: error: unable to execute command: Aborted (core dumped)
clang-5.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 5.0.0 (trunk 304921)
Target: i386-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-5.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-5.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-5.0: note: diagnostic msg: /tmp/small-7e453f.c
clang-5.0: note: diagnostic msg: /tmp/small-7e453f.sh
clang-5.0: note: diagnostic msg: 

********************
$ 
$ cat small.c
int printf(const char*, ...);
static short a, c;
char b;
int d;
static void fn1() {
  long long f, g, j, l;
L2:
  a = 14;
  int h = g | b, i = g ^ f;
L4:
  c = h && 4 % b;
  if (i <= 406488 && a < h) {
    printf("%llu\n", (long long)c);
    goto L4;
  }
  if (g > 5) {
    printf("%lld\n", (long long)4);
    goto L3;
  }
  if (!f || c > a)
    goto L1;
  --f;
  if (c)
    g = 4;
  if (a)
    goto L2;
  short k = a ^ d;
  j = g;
  g = k / f;
L3:
  if (!f)
    goto L5;
  g = j;
L1:
  l = g;
  if (b) {
    int m[] = {};
    goto L3;
  L5:
    ;
  }
  g = l | g;
  c = f && g;
}

int main() {
  for (;;)
    fn1();
  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/20170608/1b65af10/attachment-0001.html>


More information about the llvm-bugs mailing list