From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9A1CD3857C74; Wed, 31 Mar 2021 18:46:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9A1CD3857C74 From: "hubicka at ucw dot cz" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/99309] [10/11 Regression] Segmentation fault with __builtin_constant_p usage at -O2 Date: Wed, 31 Mar 2021 18:46:37 +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: 10.2.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: hubicka at ucw dot cz 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: 10.3 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 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: Wed, 31 Mar 2021 18:46:37 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99309 --- Comment #7 from Jan Hubicka --- > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99309 >=20 > --- Comment #6 from Jakub Jelinek --- > (In reply to Jan Hubicka from comment #5) > > As discussed, I can prepare patch to make inliner to redirect > > __builtin_constant_p to __builtin_true whenever inliner detect that the > > expression is compile time ocnstant. This will avoid us eventually hit= ting > > unreachable when late optimizations forget to make the transformation. >=20 > I'm quite worried about that, the point of guarding something with > __builtin_constant_p is about the hope that the argument of that builtin = will > evaluate to constant in the conditional block guarded by it. > By folding __builtin_constant_p to true if it sees it as constant but not > actually propagating that constant to all uses of that expression we coul= d have > the condition folded to true, but if SRA or FRE etc. is disabled or isn't= able > to optimize it, we wouldn't have it constant. Yes, it is not good (this is why I did not implement it earlier). However you can trigger same problem without inline. Just put enough statements between the conditional and use so AO walk oracles gives up... Honza=