[llvm-bugs] [Bug 27348] New: crash at -Os and above in 32-bit mode on x86_64-linux-gnu (Assertion `Reg && "Null register has no regunits"' failed)

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 14 00:07:15 PDT 2016


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

            Bug ID: 27348
           Summary: crash at -Os and above in 32-bit mode on
                    x86_64-linux-gnu (Assertion `Reg && "Null register has
                    no regunits"' failed)
           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

The following code crashes the trunk at -Os and above only in 32-bit mode on
x86_64-linux-gnu. 



$: clang-trunk -v
clang version 3.9.0 (trunk 266174)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.3
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.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.3
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.3.0
Found candidate GCC installation:
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.3
Found candidate GCC installation:
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.7.4
Found candidate GCC installation:
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.8.2
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$: 
$: clang-trunk -m32 -Os -w small.c
clang-3.9:
/tmp/llvm-builder/llvm-source-trunk/include/llvm/MC/MCRegisterInfo.h:554:
llvm::MCRegUnitIterator::MCRegUnitIterator(unsigned int, const
llvm::MCRegisterInfo*): Assertion `Reg && "Null register has no regunits"'
failed.
0  clang-3.9       0x0000000001d7b6e5
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  clang-3.9       0x0000000001d79676 llvm::sys::RunSignalHandlers() + 54
2  clang-3.9       0x0000000001d79894
3  libpthread.so.0 0x00007f874626a340
4  libc.so.6       0x00007f8745488cc9 gsignal + 57
5  libc.so.6       0x00007f874548c0d8 abort + 328
6  libc.so.6       0x00007f8745481b86
7  libc.so.6       0x00007f8745481c32
8  clang-3.9       0x0000000000d4c408
9  clang-3.9       0x0000000001721d48
llvm::LiveIntervals::addKillFlags(llvm::VirtRegMap const*) + 376
10 clang-3.9       0x00000000018d55cd
11 clang-3.9       0x0000000001780b15
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 357
12 clang-3.9       0x0000000001a01b13
llvm::FPPassManager::runOnFunction(llvm::Function&) + 643
13 clang-3.9       0x0000000001a0215b
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 619
14 clang-3.9       0x0000000001ec255a
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&,
llvm::DataLayout const&, llvm::Module*, clang::BackendAction,
llvm::raw_pwrite_stream*) + 4202
15 clang-3.9       0x00000000024e3dba
16 clang-3.9       0x000000000282bbed clang::ParseAST(clang::Sema&, bool, bool)
+ 845
17 clang-3.9       0x00000000024e411e clang::CodeGenAction::ExecuteAction() +
78
18 clang-3.9       0x00000000021ca4ae clang::FrontendAction::Execute() + 286
19 clang-3.9       0x00000000021a2c66
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 310
20 clang-3.9       0x0000000002254ea2
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2370
21 clang-3.9       0x0000000000ac1188 cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 3288
22 clang-3.9       0x0000000000a7cc7d main + 6125
23 libc.so.6       0x00007f8745473ec5 __libc_start_main + 245
24 clang-3.9       0x0000000000abd1d4
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 -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 -Os -w -fdebug-compilation-dir
/data2/c-hunter-results/C/instrument-bugs/REDUCED/20160413-clang-trunk-m32-g-O3-build-060928/delta
-ferror-limit 19 -fmessage-length 175 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o /tmp/small-46bc94.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 'Virtual Register Rewriter' on function '@fn1'
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 266174)
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-183060.c
clang-3.9: note: diagnostic msg: /tmp/small-183060.sh
clang-3.9: note: diagnostic msg: 

********************
$: clang-trunk -m64 -Os -w small.c
$: cat small.c
char a, h, o, q;
volatile short b, n;
int c, e, i, j, l, m, p, r;
unsigned d;
short f;
volatile char g;
volatile int k;
void fn1() {
  for (;;) {
    for (; o <= 5;) {
      if (l > 7)
        goto LABEL_XhXhh;
    LABEL_lilig:
      if (l)
      LABEL_lilih:
      k;
      if (f)
        continue;
      break;
    }
    int s = o;
    {
      char t = f || b;
      if (b)
        goto LABEL_YhYho;
      if (s)
        goto LABEL_XhXhg;
    }
  LABEL_7h7hn:
    ;
    int u = h;
    {
    LABEL_XhXhg:
      ;
      int v = h || d;
      i = ~v;
      g;
      if (!i)
        goto LABEL_MiMiz;
      goto LABEL_7h7hn;
    LABEL_XhXhh:
      e = 1;
    }
  LABEL_QhQhg:
    ;
    char w;
    if (p)
      continue;
    int x = a;
    if (k && x) {
      while (j)
        ;
    LABEL_YhYho:
      if (h)
        goto LABEL_QhQhg;
    }
    char y = u & p || r / k;
    int z = (b ^ (u || k)) * y / z || k;
    int t1 = c > q ^ n;
    int t2 = p / m;
    short t3 = a % n;
    if (t2) {
      t1 = p;
      goto LABEL_lilih;
    LABEL_MiMiz:
      q = t3 > t1 && t2;
      goto LABEL_lilig;
    }
    printf("l_1936=%llu\n");
    goto LABEL_XhXhh;
  }
}

int main() { 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/20160414/b5f52074/attachment.html>


More information about the llvm-bugs mailing list