<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 microMIPS + "-mfp64" on floating-point store"
   href="https://bugs.llvm.org/show_bug.cgi?id=49200">49200</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Crash with microMIPS + "-mfp64" on floating-point store
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>11.0
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jesse.a.deguire@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=24534" name="attach_24534" title="Clang output, crash report files, and bugpoint output">attachment 24534</a> <a href="attachment.cgi?id=24534&action=edit" title="Clang output, crash report files, and bugpoint output">[details]</a></span>
Clang output, crash report files, and bugpoint output

The following code will crash Clang with a stack trace when building it using
microMIPS, hardware floating-point, and the "-mfp64" option.

----------
#define __CMPLX(x, y, t) \
        ((union { _Complex t __z; t __xy[2]; }){.__xy = {(x),(y)}}.__z)

#define CMPLX(x, y) __CMPLX(x, y, double)

void foo(void)
{
    double bleh = CMPLX(0, 0);
}
----------

I realized after I put together a report that the assignment probably isn't
correct, but changing it to "_Complex double bleh" caused the same crash.

Here is the beginning portion of the crash, which also shows the options I
invoke Clang with.

----------
fatal error: error in backend: Cannot select: t15: ch = store<(store 8 into
%ir.bleh.imagp)> t14, t10, t12, undef:i32, micromips_fpu_cmplx_check.c:24:21
  t10: f64,ch = load<(dereferenceable load 8 from %ir.__z.imagp)> t22, t7,
undef:i32, micromips_fpu_cmplx_check.c:24:28
    t7: i32 = add nuw FrameIndex:i32<1>, Constant:i32<8>,
micromips_fpu_cmplx_check.c:24:28
      t1: i32 = FrameIndex<1>
      t6: i32 = Constant<8>
    t4: i32 = undef
  t12: i32 = add nuw FrameIndex:i32<0>, Constant:i32<8>,
micromips_fpu_cmplx_check.c:24:21
    t11: i32 = FrameIndex<0>
    t6: i32 = Constant<8>
  t4: i32 = undef
In function: foo
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: ./pic32clang/install/bin/clang -g -target
mipsel-linux-gnu-musl -march=mips32r5 -mdspr2 -mmicromips -mhard-float -mfp64
-G0 -fomit-frame-pointer -O0 -c -o micromips_fpu_cmplx_check.o
micromips_fpu_cmplx_check.c 
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module
'micromips_fpu_cmplx_check.c'.
4.      Running pass 'MIPS DAG->DAG Pattern Instruction Selection' on function
'@foo'
----------

Removing EITHER the "-mmicromips" or the "-mfp64" option will allow this code
to build.

I followed the "How to submit an LLVM bug report" document to generate a .bc
file to give to "llc", which also crashed. I then used "bugpoint -llc-safe"
with that .bc file to generate more files. These files, the original sample
code, the files requested by the crash log, and the output of Clang and llc are
included in the attached ZIP file.</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>