<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 - Risc-V C compiler assert #2"
   href="https://bugs.llvm.org/show_bug.cgi?id=42115">42115</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Risc-V C compiler assert #2
          </td>
        </tr>

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

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

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

        <tr>
          <th>Component</th>
          <td>C
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>grogers@micron.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=22067" name="attach_22067" title="source for the assert">attachment 22067</a> <a href="attachment.cgi?id=22067&action=edit" title="source for the assert">[details]</a></span>
source for the assert

risc-v clang assert on the following code:

void 
test(int n, complex double s[], complex double a[], complex double b[])
{   
    int i;
    for (i=0;i<n;i++) 
        s[i] = a[i] * b[i];
}

with the following back-trace:
mfed03: grogers: complex $ ./dcmplx5.compile dcmplx5
fatal error: error in backend: Cannot select: 0x563c18a9c8e0: f64 = bitcast
      0x563c18a9ba40
  0x563c18a9ba40: i64,ch,glue = CopyFromReg 0x563c18a9bd18:1, Register:i64
$x11, 0x563c18a9bd18:2
    0x563c18a9baa8: i64 = Register $x11
    0x563c18a9bd18: i64,ch,glue = CopyFromReg 0x563c18a9bd80, Register:i64
$x10, 0x563c18a9bd80:1
      0x563c18a9b9d8: i64 = Register $x10
      0x563c18a9bd80: ch,glue = callseq_end 0x563c18a9c400,
TargetConstant:i64<0>, TargetConstant:i64<0>, 0x563c18a9c400:1
        0x563c18a9e870: i64 = TargetConstant<0>
        0x563c18a9e870: i64 = TargetConstant<0>
        0x563c18a9c400: ch,glue = RISCVISD::CALL 0x563c18a9bf88,
TargetGlobalAddress:i64<[2 x i64] (double, double, double, double)* @__muldc3>
0, Register:f64 $x10, Register:f64 $x11, Register:f64 $x12, Register:f64 $x13,
RegisterMask:Untyped, 0x563c18a9bf88:1
          0x563c18a9bc48: i64 = TargetGlobalAddress<[2 x i64] (double, double,
double, double)* @__muldc3> 0
          0x563c18a9c058: f64 = Register $x10
          0x563c18a9eae0: f64 = Register $x11
          0x563c18a9c4d0: f64 = Register $x12
          0x563c18a9c0c0: f64 = Register $x13
          0x563c18a9bcb0: Untyped = RegisterMask
          0x563c18a9bf88: ch,glue = CopyToReg 0x563c18a9bf20, Register:f64
$x13, 0x563c18a9c7a8, 0x563c18a9bf20:1
            0x563c18a9c0c0: f64 = Register $x13
            0x563c18a9c7a8: f64,ch = CopyFromReg 0x563c18a31698, Register:f64
%11
              0x563c18a9bb10: f64 = Register %11
            0x563c18a9bf20: ch,glue = CopyToReg 0x563c18a9c1f8, Register:f64
$x12, 0x563c18a9c6d8, 0x563c18a9c1f8:1
              0x563c18a9c4d0: f64 = Register $x12
              0x563c18a9c6d8: f64,ch = CopyFromReg 0x563c18a31698, Register:f64
%10
                0x563c18a9c5a0: f64 = Register %10
              0x563c18a9c1f8: ch,glue = CopyToReg 0x563c18a9c810, Register:f64
$x11, 0x563c18a9c608, 0x563c18a9c810:1
                0x563c18a9eae0: f64 = Register $x11
                0x563c18a9c608: f64,ch = CopyFromReg 0x563c18a31698,
Register:f64 %9
                  0x563c18a9c468: f64 = Register %9
                0x563c18a9c810: ch,glue = CopyToReg 0x563c18a9e9a8,
Register:f64 $x10, 0x563c18a9c670
                  0x563c18a9c058: f64 = Register $x10
                  0x563c18a9c670: f64,ch = CopyFromReg 0x563c18a31698,
Register:f64 %8

Here is the shell commands:
# Crash reproducer for clang version 8.0.0 
# Driver args: "-O2" "-I" "/nethome/grogers/scratch/emd/emd/simlib/include"
"dcmplx5.r5.c" "-L/nethome/grogers/scratch/emd/emd/emd-clang/simlib/lib"
"-Wl,-static" "-lhtp_runtime" "-o" "dcmplx5.r5.exe"
# Original command:  "/work/grogers/llvm-project/riscv-build/riscv/bin/clang-8"
"-cc1" "-triple" "riscv64-unknown-unknown-elf" "-emit-obj" "-disable-free"
"-disable-llvm-verifier" "-discard-value-names" "-main-file-name"
"dcmplx5.r5.c" "-mrelocation-model" "static" "-mthread-model" "posix"
"-fmath-errno" "-masm-verbose" "-mconstructor-aliases" "-nostdsysteminc"
"-fuse-init-array" "-target-abi" "lp64" "-dwarf-column-info"
"-debugger-tuning=gdb" "-momit-leaf-frame-pointer" "-resource-dir"
"/work/grogers/llvm-project/riscv-build/riscv/lib/clang/8.0.0" "-I"
"/nethome/grogers/scratch/emd/emd/simlib/include" "-isysroot"
"/nethome/grogers/scratch/emd/llvm-riscv-tools/riscv-build/riscv/riscv64-unknown-elf"
"-internal-isystem"
"/nethome/grogers/scratch/emd/llvm-riscv-tools/riscv-build/riscv/riscv64-unknown-elf/include"
"-O2" "-fdebug-compilation-dir"
"/nethome/grogers/scratch/emd/emd/htp-tests/apps/complex" "-ferror-limit" "19"
"-fmessage-length" "80" "-fno-signed-char" "-fobjc-runtime=gcc"
"-fdiagnostics-show-option" "-fcolor-diagnostics" "-vectorize-loops"
"-vectorize-slp" "-o" "/tmp/dcmplx5-153342.o" "-x" "c" "dcmplx5.r5.c"
"-faddrsig"
 "/work/grogers/llvm-project/riscv-build/riscv/bin/clang-8" "-cc1" "-triple"
"riscv64-unknown-unknown-elf" "-emit-obj" "-disable-free"
"-disable-llvm-verifier" "-discard-value-names" "-main-file-name"
"dcmplx5.r5.c" "-mrelocation-model" "static" "-mthread-model" "posix"
"-fmath-errno" "-masm-verbose" "-mconstructor-aliases" "-nostdsysteminc"
"-fuse-init-array" "-target-abi" "lp64" "-dwarf-column-info"
"-debugger-tuning=gdb" "-momit-leaf-frame-pointer" "-O2" "-ferror-limit" "19"
"-fmessage-length" "80" "-fno-signed-char" "-fobjc-runtime=gcc"
"-fdiagnostics-show-option" "-fcolor-diagnostics" "-vectorize-loops"
"-vectorize-slp" "-x" "c" "dcmplx5-0b62f4.c" "-faddrsig"</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>