From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A222D3858429; Mon, 1 Nov 2021 20:44:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A222D3858429 From: "jsm28 at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/103031] New: [12 Regression] Missing static initializer folding with -frounding-math Date: Mon, 01 Nov 2021 20:44:17 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jsm28 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: 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: Mon, 01 Nov 2021 20:44:17 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103031 Bug ID: 103031 Summary: [12 Regression] Missing static initializer folding with -frounding-math Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: jsm28 at gcc dot gnu.org CC: rguenth at gcc dot gnu.org Target Milestone: --- One of the recent fixes to avoid inappropriate constant folding with -frounding-math caused the following test to produce an error when building with -frounding-math. Static initializers in C are evaluated at translation time, in the default rounding mode and with exceptions discarded; -frounding-math should not affect this. Indeed, fold-const.c has START_FOLD_INIT and END_FOLD_INIT that are supposed to be used for static initializer folding to implement this, but apparently aren't being effectiv= e in this case. Test case: double x =3D -1ULL; Errors: t.c:1:12: error: initializer element is not computable at load time 1 | double x =3D -1ULL; | ^ Note: if the initializer is cast to double, things work fine; it's only the case of implicit conversion that has the problem, so maybe something is han= dled differently for folding an implicit conversion of a static initializer. This breaks building glibc tests for some platforms: https://sourceware.org/pipermail/libc-alpha/2021-October/132475.html=