https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80786
Mikael Pettersson <mikpelinux at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mikpelinux at gmail dot com --- Comment #4 from Mikael Pettersson <mikpelinux at gmail dot com> --- Reduced test case: > cat /tmp/pr80786.c extern long G[]; void dir_op(short op, short *dirs) { if (!op) *dirs = G[1]; } > gcc/xgcc -Bgcc -O2 -mpcrel -S /tmp/pr80786.c during RTL pass: final /tmp/pr80786.c: In function 'dir_op': /tmp/pr80786.c:7:1: internal compiler error: in change_address_1, at emit-rtl.cc:2299 7 | } | ^ 0x40dc15 change_address_1 /mnt/scratch/other/mikpe-gcc.git/gcc/emit-rtl.cc:2299 0x668fc9 adjust_address_1(rtx_def*, machine_mode, poly_int<1u, long>, int, int, int, poly_int<1u, long>) /mnt/scratch/other/mikpe-gcc.git/gcc/emit-rtl.cc:2433 0x10c2ea2 output_80 /mnt/scratch/other/mikpe-gcc.git/gcc/config/m68k/m68k.md:1678 ... This is gcc-14 from 2023-12-30, and output_80 is m68k.md's truncsihi2 insn. The source operand is (mem:SI (const:SI (plus:SI (symbol_ref:SI ("G") [flags 0x40] <var_decl 0x7f3eb88f1000 G>) (const_int 4 [0x4]))) [1 G[1]+0 S4 A16]) which truncsihi2 wants to adjust by adding 2 to the offset, but (const:SI (plus:SI (symbol_ref:SI ("G") [flags 0x40] <var_decl 0x7f3eb88f1000 G>) (const_int 6 [0x6]))) is rejected by m68k_legitimate_constant_address_p, causing m68k_decompose_address to fail, and the assert in change_address_1 to fire. Disabling this insn for TARGET_PCREL seems to work, but I don't know what negative side-effects that might have. gcc-4.9 and older were ok, gcc-5 and above ICE, starting with aea3d681ec784b1a44ee3b37b0df2b71bdfadfc3 is the first new commit commit aea3d681ec784b1a44ee3b37b0df2b71bdfadfc3 Author: DJ Delorie <d...@redhat.com> Date: Fri Aug 29 19:19:42 2014 -0400 expr.c (convert_move): If the target has an explicit converter, use it.