From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3831338708B7; Tue, 25 Jun 2024 19:58:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3831338708B7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1719345507; bh=4ns1Sqahw1zF3GKiLk1asdNedwnqgIO1Nu4E94pe4Cw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PlyT58M4zoNMXoxpmTdqParXh/O6DLJehJEfxzQrETS8alWEQxZHxRXh+AVxQrVF6 O793egkcTGFSohjnhRKYTbNEBULcOydRhdBLa7Z0I2r7P4VuwW4raDsjCy5DMmiSo8 fHVVvJyysjJOMCCRpGN2+cgjUv/aexPqh3LLDY24= From: "mpolacek at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/115641] [11/12/13/14/15 Regression] GCC crashes on function has attribute `__attribute__((const))` Date: Tue, 25 Jun 2024 19:58:26 +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: 15.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: mpolacek at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.5 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=3D115641 Marek Polacek changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #2 from Marek Polacek --- It's the --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -4447,8 +4447,7 @@ simple_operand_p_2 (tree exp) { enum tree_code code; - if (TREE_SIDE_EFFECTS (exp) - || tree_could_trap_p (exp)) + if (TREE_SIDE_EFFECTS (exp) || generic_expr_could_trap_p (exp)) return false; while (CONVERT_EXPR_P (exp)) change. simple_condition_p gets ((short unsigned int) BIT_FIELD_REF [(void *)&f ()], 16, 0>= & 65535) !=3D 513 and generic_expr_could_trap_p recurses down to tree_could_trap_p getting MEM [(void *)&f ()] where we get the base which is "f ()" but DECL_SIZE_UNIT crashes on that.=