<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"
   href="https://llvm.org/bugs/show_bug.cgi?id=27983">27983</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>crash with "-O3 -m32" on x86_64-linux-gnu
          </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>All
          </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 trunk at -O3 in 32-bit mode on x86_64-linux-gnu.



$:
$: clang-trunk -v
clang version 3.9.0 (trunk 271236)
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 -w -O3 -m32 small.c
0  clang-3.9       0x0000000001dfd8b5
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  clang-3.9       0x0000000001dfb846 llvm::sys::RunSignalHandlers() + 54
2  clang-3.9       0x0000000001dfba64
3  libpthread.so.0 0x00007f20f1c2e340
4  clang-3.9       0x0000000001945594
llvm::LiveRangeEdit::eliminateDeadDef(llvm::MachineInstr*,
llvm::SetVector<llvm::LiveInterval*, llvm::SmallVector<llvm::LiveInterval*,
8u>, llvm::SmallPtrSet<llvm::LiveInterval*, 8u> >&) + 3460
5  clang-3.9       0x0000000001946167
llvm::LiveRangeEdit::eliminateDeadDefs(llvm::SmallVectorImpl<llvm::MachineInstr*>&,
llvm::ArrayRef<unsigned int>) + 215
6  clang-3.9       0x00000000019968b0
7  clang-3.9       0x000000000199fe66
8  clang-3.9       0x0000000001978862
9  clang-3.9       0x000000000197a197
10 clang-3.9       0x000000000198239e
11 clang-3.9       0x0000000001983edb
12 clang-3.9       0x00000000019b64f2 llvm::RegAllocBase::allocatePhysRegs() +
306
13 clang-3.9       0x000000000197fd32
14 clang-3.9       0x00000000017dc095
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 357
15 clang-3.9       0x0000000001a63203
llvm::FPPassManager::runOnFunction(llvm::Function&) + 643
16 clang-3.9       0x0000000001a6384b
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 619
17 clang-3.9       0x0000000001f4cb5a
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&,
llvm::DataLayout const&, llvm::Module*, clang::BackendAction,
llvm::raw_pwrite_stream*) + 4282
18 clang-3.9       0x00000000025939ad
19 clang-3.9       0x00000000028f27dd clang::ParseAST(clang::Sema&, bool, bool)
+ 845
20 clang-3.9       0x0000000002593d0e clang::CodeGenAction::ExecuteAction() +
78
21 clang-3.9       0x0000000002271c5e clang::FrontendAction::Execute() + 286
22 clang-3.9       0x0000000002247ba6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 310
23 clang-3.9       0x00000000022feb72
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2370
24 clang-3.9       0x0000000000ae2fc8 cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 3272
25 clang-3.9       0x0000000000a9c8ae main + 6350
26 libc.so.6       0x00007f20f0e37ec5 __libc_start_main + 245
27 clang-3.9       0x0000000000adf034
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/20160523-clang-trunk-m32-g-O3-build-190613/delta
-ferror-limit 19 -fmessage-length 344 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o /tmp/small-d77752.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: Segmentation fault (core dumped)
clang-3.9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.9.0 (trunk 271236)
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-fbd513.c
clang-3.9: note: diagnostic msg: /tmp/small-fbd513.sh
clang-3.9: note: diagnostic msg:

********************
$:
$:
$: cat small.c
short a, b, c, f, h, j, n, v, z;
int d, e, k, p, q, r, s, t, w, y, t1;
long g, i, l, m, x;
char o, u;
void fn1() {
  unsigned t2;
  for (;;) {f67
    long long t3 = 2;
    long t4 = r && t2;
    if (r > d) {
      t2 = t4 >> k;
      if (g)
        if (t2)
          goto L6;
    }
    if (l)
      for (;;)
        ;
    long t5 = g / a;
    if (t5)
    L4:
    goto L5;
    for (; t1;)
      for (; o;)
        for (; q;)
          for (; u;)
          L1:
    t3 = v;
    if (t3) {
      int t6;
      for (; p; p++)
        if (b) {
          short t7 = n;
          if (t) {
            int t8;
            printf("g_194=%lld\n", (long long)f);
            if (m)
              goto L1;
          L3:
            if (x) {
              if (e)
                break;
              goto L2;
            }
            printf("l_1421=%llu\n", t3);
            if (r) {
              t7 = 0;
              for (; t7 != -8; --t7)
                if (n)
                  break;
            }
            if (w) {
              int t9 = j;
              if (f)
              L5:
              s = t9;
              if (r)
                break;
            }
            if (y) {
              y = i % m;
              goto L4;
            }
            t7 = z;
          }
          z = t7;
        L6:
          ;
          short t10;
          if (c <= 7) {
            while (r)
              ;
            if (h)
              goto L3;
          }
        }
      if (m)
        for (;;)
        L2:
      ;
    }
  }
}

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>