From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A25F53858C74; Fri, 27 Jan 2023 09:53:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A25F53858C74 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674813214; bh=W/6+h9gqoJVq8YuKJ4lRF2SpaDtzlhkNrZpz/HYonHM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=cnoYI76xbZran19VyzFuPfN9WvW+gHkmr+uMkmgUo+BPmGmZDe++VC1K9MYZskYn/ 81qXWyttnSg7a3mj4O7DRLk4HJgFvxko2WTKGwBhVDID8UoWN909OvrX+XHc+BWcgq x+cpNzR1eo8RoKzRjzf3sXYoW3KLZ93/IdJfi4MQ= From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107608] [13 Regression] Failure on fold-overflow-1.c and pr95115.c Date: Fri, 27 Jan 2023 09:53:33 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: missed-optimization, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenther at suse dot de X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 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=3D107608 --- Comment #47 from rguenther at suse dot de --- On Fri, 27 Jan 2023, xry111 at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107608 >=20 > --- Comment #46 from Xi Ruoyao --- > (In reply to Richard Biener from comment #45) > > (In reply to Xi Ruoyao from comment #44) > > > (In reply to rguenther@suse.de from comment #43) >=20 > > > > If the result is unused then no, GCC will happily elide exceptions = from > > > > unused computations like Inexact from the statement > > > >=20 > > > > 1./3.; > > > >=20 > > > > but this has been done before. What's new is that GCC can now elide > > > > some uses (in this case the isnan check is the only use) > > >=20 > > > The should we just change PR95115 to "INVALID" and remove the test ca= se, and > > > fix any regression on Glibc side? > >=20 > > I think we should adjust the testcase with a volatile like I suggested = above > > so we verify that we don't eliminate the computation with a "constant" = NaN. >=20 > Ok, I'll post a patch. >=20 > Glibc already changed the code from Inf/Inf to (x - x) / (x - x) where x= =20 > is not a constant, but I'm wandering if the compiler will attempt to=20 > optimize out (x - x) / (x - x) later... Is it possible to provide a=20 > "__builtin_feraiseexcept" so we'd be able to use it instead of the nasty= =20 > (x - x) / (x - x) to raise the exception? Not trivially. I'd suggest glibc uses a volatile use, like for example tem =3D Inf/Inf; __asm__ volatile ("" : : "g" (tem)); or so to preserve the computation and avoid an actual store to a volatile variable. Though I see at least GCC 7 optimizing the above division to a constant, lacking a fix we deployed later.=