From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 634AD3858412; Mon, 1 Jan 2024 15:30:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 634AD3858412 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1704123025; bh=db5ptZHlHuq3iV2n2MCZwVQdsvcIlH3h0CPgipgJC8I=; h=From:To:Subject:Date:In-Reply-To:References:From; b=QHQ38Pc/AvPQ64ALeOAqoyYWUUnRUeSx+CFLRcr260EKC8bq/kPzhXREk1AnrmWzV SPHULoZxnUy2+jmuOR0wdlcCwu5lgUIILl9v8cwJDBkUtwn/By5724BHeBSzcNCdDR /bM4sBfqbU4xBuas6t4m7W1DKsh5238AGl3NLE8E= From: "mikpelinux at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/80786] m68k: internal compiler error: in change_address_1 Date: Mon, 01 Jan 2024 15:30:22 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 7.1.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: mikpelinux at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D80786 Mikael Pettersson changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mikpelinux at gmail dot com --- Comment #4 from Mikael Pettersson --- Reduced test case: > cat /tmp/pr80786.c extern long G[]; void dir_op(short op, short *dirs) { if (!op) *dirs =3D 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] ) (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] ) (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 Date: Fri Aug 29 19:19:42 2014 -0400 expr.c (convert_move): If the target has an explicit converter, use it.=