From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BB95B385828B; Mon, 20 Nov 2023 09:55:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BB95B385828B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1700474131; bh=yXE/hiz9zbxyZIxBZ6f/48wHIiOfb7VJk5ug8idZTAM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=cY+5S3gZaZUWSM2Alsgf+ELJyeKmm68JYAiRAzIWTW/6e9v2MMLJt5aG3u+nn2qI1 1Fx1EC8N2kPxUaWpN03owquKZsWw2n3xbVrCdAmtnXuxL8d1bBd7o+b/SDyoY+4gfz XNQRCg+sHPi/EzQl6E7B6p5OXtjvOreSVX1xaLT4= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/112616] [11/12/13/14 Regression] wrong code at -O{s,2,3} on x86_64-linux-gnu Date: Mon, 20 Nov 2023 09:55:30 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: 13.2.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth 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: priority 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D112616 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P3 |P2 CC| |hubicka at gcc dot gnu.org, | |jamborm at gcc dot gnu.org Version|unknown |13.2.1 --- Comment #3 from Richard Biener --- IPA-SRA at work. With -fno-inline added you see -long int p () +void p.isra () { ... @@ -106,13 +82,13 @@ i.2_2 =3D i; h.3_3 =3D h; *i.2_2 =3D h.3_3; - _4 =3D o (); + o.isra (); [local count: 1073741824]: - # q_11 =3D PHI <0B(2), _4(3)> - _5 =3D *q_11; - _10 =3D (long int) _5; - return _10; + # q_5 =3D PHI <0B(2), removed_return.17_12(D)(3)> + _6 =3D *q_5; + _7 =3D (long int) _6; + return; Note the issue is that we end up with the following after inlining: [local count: 1073741824]: # q_11 =3D PHI <0B(2), removed_return.14_14(D)(4), removed_return.14_14(D= )(3)> _12 =3D *q_11; and CCP will optimistically simplify q_11 to 0B because accessing the removed_return.14_14(D) would be undefined behavior. That means substituting a default-def isn't correct - it exposes undefined behavior on valid paths of the program.=