[Bug c/100840] New: ICE with -O1: in replace_reg, at reg-stack.c:714

cnsun at uwaterloo dot ca gcc-bugzilla@gcc.gnu.org
Mon May 31 06:02:26 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100840

            Bug ID: 100840
           Summary: ICE with -O1: in replace_reg, at reg-stack.c:714
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.zS0RT0UjCW-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210531 (experimental) [master revision
:e6428eb51:e21e93407202e62a10c372595076c593c561bb11] (GCC)

$ cat mutant.c
main() {
  long double res;
  asm("lxr\t%0,%1\n" : "=&f"(res));
  assert(res == 42.);
}

$ gcc-trunk -O1 mutant.c
mutant.c:1:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    1 | main() {
      | ^~~~
mutant.c: In function ‘main’:
mutant.c:4:3: warning: implicit declaration of function ‘assert’
[-Wimplicit-function-declaration]
    4 |   assert(res == 42.);
      |   ^~~~~~
mutant.c:1:1: note: ‘assert’ is defined in header ‘<assert.h>’; did you forget
to ‘#include <assert.h>’?
  +++ |+#include <assert.h>
    1 | main() {
mutant.c:3:3: error: output constraint 0 must specify a single register
    3 |   asm("lxr\t%0,%1\n" : "=&f"(res));
      |   ^~~
during RTL pass: stack
mutant.c:5:1: internal compiler error: in replace_reg, at reg-stack.c:714
    5 | }
      | ^
0x72f5c6 replace_reg
        /tmp/tmp.zS0RT0UjCW-gcc-builder/gcc/gcc/reg-stack.c:714
0x72f5c6 replace_reg
        /tmp/tmp.zS0RT0UjCW-gcc-builder/gcc/gcc/reg-stack.c:712
0xe6b272 compare_for_stack_reg
        /tmp/tmp.zS0RT0UjCW-gcc-builder/gcc/gcc/reg-stack.c:1379
0xe6b272 subst_stack_regs_pat
        /tmp/tmp.zS0RT0UjCW-gcc-builder/gcc/gcc/reg-stack.c:1998
0xe6bb0a subst_stack_regs
        /tmp/tmp.zS0RT0UjCW-gcc-builder/gcc/gcc/reg-stack.c:2441
0xe6c4ec convert_regs_1
        /tmp/tmp.zS0RT0UjCW-gcc-builder/gcc/gcc/reg-stack.c:3077
0xe6c4ec convert_regs_2
        /tmp/tmp.zS0RT0UjCW-gcc-builder/gcc/gcc/reg-stack.c:3211
0xe6d160 convert_regs
        /tmp/tmp.zS0RT0UjCW-gcc-builder/gcc/gcc/reg-stack.c:3246
0xe6d160 reg_to_stack
        /tmp/tmp.zS0RT0UjCW-gcc-builder/gcc/gcc/reg-stack.c:3371
0xe6d160 rest_of_handle_stack_regs
        /tmp/tmp.zS0RT0UjCW-gcc-builder/gcc/gcc/reg-stack.c:3426
0xe6d160 execute
        /tmp/tmp.zS0RT0UjCW-gcc-builder/gcc/gcc/reg-stack.c:3458
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.


More information about the Gcc-bugs mailing list