[llvm-bugs] [Bug 50678] New: Invalid aarch64 instruction related to __int128

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 11 03:04:39 PDT 2021


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

            Bug ID: 50678
           Summary: Invalid aarch64 instruction related to __int128
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: jean-philippe at linaro.org
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org

Created attachment 24942
  --> https://bugs.llvm.org/attachment.cgi?id=24942&action=edit
Small reproducer causing invalid aarch64 instruction generation with
-no-integrated-as

When building the attached reproducer with:

clang --target=aarch64-linux-gnu --sysroot=/usr/aarch64-linux-gnu
--gcc-toolchain=/usr -no-integrated-as -o reprod-clang-no-ias reprod.c

I get the following error:

/tmp/reprod-f81ff0.s: Assembler messages:
/tmp/reprod-f81ff0.s:52: Error: operand 1 must be an integer register -- `mrs
d0,NZCV'
clang-13: error: assembler command failed with exit code 1 (use -v to see
invocation)

The invalid instruction seems to show up when passing a __int128 cast to
uint64_t as Nth argument to printf, where N is large enough to exceed the
number of register parameters.

I use clang from the git repo (clang version 13.0.0
(https://github.com/llvm/llvm-project.git
22f194909ae24aed817976fb54b759550e90db36))

When built with -integrated-as, the resulting binary contains a valid 'mrs
x0,NZCV' instruction. However, on the original test case (Linux BPF selftests),
the binary generated with -integrated-as segfaults somewhere within that printf
call:

Stack trace:
./test_progs(crash_handler+0x2c)[0x4fc60c]
linux-vdso.so.1(__kernel_rt_sigreturn+0x0)[0xffffaa675850]
/lib/libc.so.6(+0x6e2b8)[0xffffaa48b2b8]
/lib/libc.so.6(__snprintf+0x70)[0xffffaa469ba0]
./test_progs(get_pprint_expected_line+0x3e4)[0x428ff8]
./test_progs[0x42f5f4]
./test_progs[0x42c458]
./test_progs(test_btf+0x10c)[0x429134]
./test_progs(main+0x248)[0x4fc948]
/lib/libc.so.6(__libc_start_main+0xc4)[0xffffaa441994]
./test_progs[0x40d0b4]
Segmentation fault

I'm guessing that error is related since it's in the same location as the one
reported here, but I'm still trying to reproduce it with a simpler case.

-- 
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/20210611/3829034d/attachment.html>


More information about the llvm-bugs mailing list