From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1611A3857C45; Sun, 3 Dec 2023 12:37:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1611A3857C45 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1701607046; bh=10Re5lzeZeltretCfCi95R/z29mD4rPb9rGCzK99KwM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=WQHfEeXB2iMgCNfs7NXbzvY7kN2EDz+3t3T/udSqjoZXPaq+OSy9lFPFVhLtnr/GH GkQvsnPFq+tdRuywp4UsGe6tSZn8g6/xAvmx1TFkF3lWRbukUxOP08HjDyfyz4jnK8 Fz7eDzeijaWE4/ysrNXjJLA3xYWMBAjnVCEJJ9ds= From: "gjl at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/112830] internal compiler error: in convert_memory_address_addr_space_1, at explow.cc:302 Date: Sun, 03 Dec 2023 12:37:25 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: addr-space, ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: gjl at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: cf_gcctarget keywords 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=3D112830 Georg-Johann Lay changed: What |Removed |Added ---------------------------------------------------------------------------- Target| |avr Keywords| |addr-space, | |ice-on-valid-code --- Comment #1 from Georg-Johann Lay --- In explow.cc, we have: rtx convert_memory_address_addr_space_1 (...) { #ifndef POINTERS_EXTEND_UNSIGNED gcc_assert (GET_MODE (x) =3D=3D to_mode || GET_MODE (x) =3D=3D VOIDmode);= // line 302 return x; #else /* defined(POINTERS_EXTEND_UNSIGNED) */ so it seems the backend has to define POINTERS_EXTEND_UNSIGNED, which it currently doesn't. However, the documentation of PEU reads: > Macro: POINTERS_EXTEND_UNSIGNED > A C expression that determines how pointers should be extended from > ptr_mode to either Pmode or word_mode. It is greater than zero if > pointers should be zero-extended, zero if they should be sign-extended, > and negative if some other sort of conversion is needed. In the last ca= se, > the extension is done by the target=E2=80=99s ptr_extend instruction. > You need not define this macro if the ptr_mode, Pmode and word_mode are > all the same width.=20 The avr backend has: Pmode =3D word_mode =3D HImode (16 bits), mode for ADDR_SPACE_GENERIC PSImode =3D 24 bits, mode for ADDR_SPACE_MEMX, aka. __memx So it appear the middle-end wants to "extend" a pointer from 24-bit PSImode= to 16-bit Pmode, which makes no sense. Apart from that, the code does not req= uire any pointer adjustments. One guess is that the middle-end tries to expand the memcpy, because insn cpymemhi only support CONST_INT lengths, and gets somethig wrong about addr= ess spaces. The backend defines TARGET_ADDR_SPACE_CONVERT, and TARGET_ADDR_SPACE_ADDRESS_MODE is the same like TARGET_ADDR_SPACE_POINTER_M= ODE for all address spaces.=