From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2F28F385743F; Fri, 2 Jul 2021 06:32:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2F28F385743F From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/101290] ICE with -O1 on valid code: in maybe_canonicalize_mem_ref_addr, at gimple-fold.c:5976 Date: Fri, 02 Jul 2021 06:32:46 +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: 12.0 X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth 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: keywords component cc version 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Jul 2021 06:32:47 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101290 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |accepts-invalid Component|tree-optimization |middle-end CC| |jsm28 at gcc dot gnu.org Version|tree-ssa |12.0 --- Comment #1 from Richard Biener --- We're asking get_addr_base_and_unit_offset on arg0 of MEM[(volatile int *)&MEM[(struct *)&h].f] and the FIELD_DECL is unit-size align:32 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7ffff6677e70 fields BLK t.c:56:7 size unit-size align:32 warn_if_not_align:0 offset_align 128 offset bit-offset context chain > context pointer_to_this chain > BLK t.c:57:11 size unit-size align:32 warn_if_not_align:0 offset_align 32 offset constant public overflow 10790227672893396768> bit-offset context > and we hit case COMPONENT_REF: { tree field =3D TREE_OPERAND (exp, 1); tree this_offset =3D component_ref_field_offset (exp); poly_int64 hthis_offset; if (!this_offset || !poly_int_tree_p (this_offset, &hthis_offset) || (TREE_INT_CST_LOW (DECL_FIELD_BIT_OFFSET (field)) % BITS_PER_UNIT)) return NULL_TREE; because this_offset doesn't fit the signed poly_int64. IIRC we do have to support negative field offsets. Eventually this testcase is invalid since sizeof (*g) is bigger than half of the address space. Joseph? We seem to happily wrap TYPE_SIZE[_UNIT] even over the sizetype bounds without diagnosing anything - we do emit some diagnostics from layout_type so that might be the place to complain (we could then set TYPE_SIZE[_UNIT] to error_mark_node). constant public overflow 0x704ef12cb04cf1580> unit-size constant public overflow 16185341509340095152>=