[llvm-bugs] [Bug 44385] New: "error in backend" caused in the code using _Float16 and long double

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Dec 26 18:29:59 PST 2019


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

            Bug ID: 44385
           Summary: "error in backend" caused in the code using _Float16
                    and long double
           Product: libraries
           Version: 9.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: AArch64
          Assignee: unassignedbugs at nondot.org
          Reporter: utsumi.yuichiro at fujitsu.com
                CC: arnaud.degrandmaison at arm.com,
                    llvm-bugs at lists.llvm.org, peter.smith at linaro.org,
                    Ties.Stuij at arm.com

When compiling the following code, "error in backend" was caused.

test.c

```
#include <stdio.h>

_Float16 test(int    const  n,
            long double const* x) {
  _Float16 ret = 0.0f16;
  for(int i=0; i<n; ++i){
    ret += (_Float16)x[i];
  }
  return ret;
}

int main() {
  long double a[35];

  for (int i=0; i<35; i++) {
    a[i] = (long double)i;
  }

  printf("test: %f\n", (float)test(35, a));

  return 0;
}
```

The command and the error when compiling at x86_64 machine is below.

```
$ clang --target=aarch64-unknown-linux-gnu -S test.c -I ./include
fatal error: error in backend: Cannot select: 0xd78c70: f16 = fp_round
0xd78da8, TargetConstant:i64<0>
  0xd78da8: f128,ch = load<(load 16 from %ir.15)> 0xd18a98, 0xd78e10, undef:i64
    0xd78e10: i64 = add 0xd786c0, 0xd78658
      0xd786c0: i64,ch = load<(dereferenceable load 8 from %ir.4)> 0xd18a98,
FrameIndex:i64<1>, undef:i64
        0xd78c08: i64 = FrameIndex<1>
        0xd78d40: i64 = undef
      0xd78658: i64 = shl 0xd78a00, Constant:i64<4>
        0xd78a00: i64,ch = load<(dereferenceable load 4 from %ir.6), sext from
i32> 0xd18a98, FrameIndex:i64<3>, undef:i64
          0xd78b38: i64 = FrameIndex<3>
          0xd78d40: i64 = undef
        0xd78588: i64 = Constant<4>
    0xd78d40: i64 = undef
  0xd787f8: i64 = TargetConstant<0>
In function: test
clang-9: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
clang version 9.0.1
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /work/utsumi/llvm9/bin
clang-9: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang-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-9: note: diagnostic msg: /tmp/test-207815.c
clang-9: note: diagnostic msg: /tmp/test-207815.sh
clang-9: note: diagnostic msg:

********************
```

To avoid the following error I specified the `-I ./include`.

```
/usr/include/gnu/stubs.h:7:11: fatal error: 'gnu/stubs-32.h' file not found
# include <gnu/stubs-32.h>
          ^~~~~~~~~~~~~~~~
1 error generated.
```

The command and the error when compiling at aarch64 machine is below.

```
$ clang test.c
fatal error: error in backend: Cannot select: t13: f16 = fp_round t11,
TargetConstant:i64<0>
  t11: f128,ch = load<(load 16 from %ir.arrayidx)> t0, t10, undef:i64
    t10: i64 = add t4, t9
      t4: i64,ch = load<(dereferenceable load 8 from %ir.x.addr)> t0,
FrameIndex:i64<1>, undef:i64
        t1: i64 = FrameIndex<1>
        t3: i64 = undef
      t9: i64 = shl t21, Constant:i64<4>
        t21: i64,ch = load<(dereferenceable load 4 from %ir.i), sext from i32>
t0, FrameIndex:i64<3>, undef:i64
          t5: i64 = FrameIndex<3>
          t3: i64 = undef
        t8: i64 = Constant<4>
    t3: i64 = undef
  t12: i64 = TargetConstant<0>
In function: test
clang-9: error: clang frontend command failed with exit code 70 (use -v to see
invocation)
Fujitsu clang version 9.0.1  (based on LLVM 9.0.1)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /work02/lang2/utsumi/build_9/bin
clang-9: note: diagnostic msg: PLEASE submit a bug report to
https://bugs.llvm.org/ and include the crash backtrace, preprocessed source,
and associated run script.
clang-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-9: note: diagnostic msg: /tmp/test-2ccc58.c
clang-9: note: diagnostic msg: /tmp/test-2ccc58.sh
clang-9: note: diagnostic msg:

********************
```

I apologize in advance that I may not be able to respond to comments or
questions because New Year holidays.

-- 
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/20191227/443b4978/attachment.html>


More information about the llvm-bugs mailing list