<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - crash with "-O3 -m32" on x86_64-linux-gnu (Assertion `!Traits::stopLess(b, a) && "Invalid interval"' failed.)"
   href="https://llvm.org/bugs/show_bug.cgi?id=27278">27278</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>crash with "-O3 -m32" on x86_64-linux-gnu (Assertion `!Traits::stopLess(b, a) && "Invalid interval"' failed.)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>chengniansun@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following code crashes the clang trunk at -O3 in 32-bit mode (not 64-bit
mode) on x86_64-linux-gnu.


$: clang-trunk -v
clang version 3.9.0 (trunk 265644)
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 small.c -w -m32 -O3
clang-3.9:
/tmp/llvm-builder/llvm-source-trunk/include/llvm/ADT/IntervalMap.h:627:
unsigned int llvm::IntervalMapImpl::LeafNode< <template-parameter-1-1>,
<template-parameter-1-2>, <anonymous>, <template-parameter-1-4>
<span class="quote">>::insertFrom(unsigned int&, unsigned int, KeyT, KeyT, ValT) [with KeyT =</span >
llvm::SlotIndex; ValT = unsigned int; unsigned int N = 9u; Traits =
llvm::IntervalMapInfo<llvm::SlotIndex>]: Assertion `!Traits::stopLess(b, a) &&
"Invalid interval"' failed.
0  clang-3.9       0x0000000001d6bbf5
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  clang-3.9       0x0000000001d69b86 llvm::sys::RunSignalHandlers() + 54
2  clang-3.9       0x0000000001d69da4
3  libpthread.so.0 0x00007f226d888340
4  libc.so.6       0x00007f226caa6cc9 gsignal + 57
5  libc.so.6       0x00007f226caaa0d8 abort + 328
6  libc.so.6       0x00007f226ca9fb86
7  libc.so.6       0x00007f226ca9fc32
8  clang-3.9       0x000000000186dd13
llvm::IntervalMapImpl::LeafNode<llvm::SlotIndex, unsigned int, 9u,
llvm::IntervalMapInfo<llvm::SlotIndex> >::insertFrom(unsigned int&, unsigned
int, llvm::SlotIndex, llvm::SlotIndex, unsigned int) + 1779
9  clang-3.9       0x0000000001879fbc
10 clang-3.9       0x000000000187a94f
11 clang-3.9       0x000000000187c19d
12 clang-3.9       0x0000000001811288
13 clang-3.9       0x0000000001811ccb
14 clang-3.9       0x00000000019434e2 llvm::RegAllocBase::allocatePhysRegs() +
306
15 clang-3.9       0x000000000180dba2
16 clang-3.9       0x0000000001774e45
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 357
17 clang-3.9       0x00000000019f4163
llvm::FPPassManager::runOnFunction(llvm::Function&) + 643
18 clang-3.9       0x00000000019f47ab
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 619
19 clang-3.9       0x0000000001eb2bd2
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&,
llvm::DataLayout const&, llvm::Module*, clang::BackendAction,
llvm::raw_pwrite_stream*) + 3266
20 clang-3.9       0x00000000024ce80a
21 clang-3.9       0x000000000280ed6d clang::ParseAST(clang::Sema&, bool, bool)
+ 845
22 clang-3.9       0x00000000024ceb6e clang::CodeGenAction::ExecuteAction() +
78
23 clang-3.9       0x00000000021b7a8e clang::FrontendAction::Execute() + 286
24 clang-3.9       0x000000000219083e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 318
25 clang-3.9       0x0000000002241d22
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2370
26 clang-3.9       0x0000000000ac4dd8 cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 3288
27 clang-3.9       0x0000000000a808ad main + 6125
28 libc.so.6       0x00007f226ca91ec5 __libc_start_main + 245
29 clang-3.9       0x0000000000ac0e24
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 -O3 -w -fdebug-compilation-dir
/data2/c-hunter-results/C/instrument-bugs/REDUCED/20160406-clang-trunk-m32-g-O3-build-135108/delta
-ferror-limit 19 -fmessage-length 261 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o /tmp/small-4be074.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 '@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 265644)
Target: i386-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-3.9: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> 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-acc623.c
clang-3.9: note: diagnostic msg: /tmp/small-acc623.sh
clang-3.9: note: diagnostic msg: 

********************
$: 
$: cat small.c
char a;
long long b, e, g;
unsigned c;
int d;
volatile short f;
short h;
volatile char i;
long j;
void fn1() {
  long long k;
  unsigned l = b & (c | 7594888613);
  int m = d || i;
  char n = e || c % l;
  k = b;
LABEL_mSmSDb:
  if (h)
    a = h;
LABEL_BRBRN:
  g = ~(~(b ^ e > g * ~d * ~k) & m % c);
  b = ~(e - l || b & (n >> j & f) * k);
  c = ~((~g - c) * d);
  if (i)
    goto LABEL_BRBRN;
  if (k) {
    printf("g_671=%lld\n", (long long)d);
    d = ~g;
    goto LABEL_BRBRN;
  }
  goto LABEL_mSmSDb;
}

int main() {}</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>