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

--- Comment #11 from Mikael Pettersson <mikpelinux at gmail dot com> ---
Reduced test case:

> cat ../pr110934.c 
extern double clobber_fp0(void);
void f(void) { clobber_fp0(); }
> gcc/xgcc -Bgcc -fzero-call-used-regs=used -fPIC -O -S ../pr110934.c
during RTL pass: zero_call_used_regs
../pr110934.c: In function 'f':
../pr110934.c:2:31: internal compiler error: in change_address_1, at
emit-rtl.cc:2299
    2 | void f(void) { clobber_fp0(); }
      |                              ^
0x40dc15 change_address_1
        /mnt/scratch/other/mikpe-gcc.git/gcc/emit-rtl.cc:2299
0x69dc1e emit_move_insn(rtx_def*, rtx_def*)
        /mnt/scratch/other/mikpe-gcc.git/gcc/expr.cc:4717
0xa0cf63 default_zero_call_used_regs(unsigned long)
        /mnt/scratch/other/mikpe-gcc.git/gcc/targhooks.cc:1112
0x6ed8fa gen_call_used_regs_seq
        /mnt/scratch/other/mikpe-gcc.git/gcc/function.cc:5928
0x6ed8fa execute
        /mnt/scratch/other/mikpe-gcc.git/gcc/function.cc:6785
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

The issue is that to zero %fp0 the generic code synthesizes a move from
(const_double:XF 0.0 [0x0.0p+0]) which is replaced by a label referencing a
literal in .rodata, but that label is rejected by
m68k_legitimate_constant_address_p due to -fPIC, which triggers the assertion
failure in change_address_1.

Reply via email to