From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 05DAE3858D28; Mon, 4 Dec 2023 19:19:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 05DAE3858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1701717572; bh=c3x8cofHpAq32JZimvS9FV6lA9u+aCNx6kcNRquHbR4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=p/dh8Fs6YZBYlzBvm0nn+/78iP0abyqCEEFHyVOz/O1n0aizXUJA0LO1Q0fLrKbOL 3oDsTHkQTREZUEMCiJLdqfp0MPlathxuyoB4ellg7vrashIz+uuFqLle7dXxlnajx0 ZJWL++/qP33s3zZv3I3z+lI0eoM0xhTYbT1bN49A= 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: Mon, 04 Dec 2023 19:19:31 +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: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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 --- Comment #9 from Georg-Johann Lay --- (In reply to Richard Biener from comment #8) > Is there a valid testcase that has __memx as the destination? Or is there > an address space with similar constraints that allows non-const accesses? No. The avr backend throws an error when a non-generic address space thing= is not const, like __memx int var; int f1 (__memx int *p) { return *p; } foo.c:1:12: error: variable 'var' must be const in order to be put into read-only section by means of '__memx' 1 | __memx int var; | ^~~ foo.c:3:21: error: pointer targeting address space '__memx' must be const in function parameter 'p' 3 | int f1 (__memx int *p) | ~~~~~~~~~~~~^ __memx covers all address spacec, including generic. But in order to write= one has to cast it to a generic pointer (after checking that it actually points= to generic and not somewhere else (flash)). (In reply to Richard Biener from comment #3) > I think the assert can be relaxed to make truncation OK. A truncation from 24-bit __memx address to some other AS (all 16 bits) would require a run-time check which 16-bit AS it encodes, and depending on that execute code fit for that AS. This is ok when the user is doing it, but the compiler should never require= any kind of truncation. And extension / casts are handled by TARGET_ADDR_SPACE_CONVERT.=