From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D116A3858D37; Fri, 14 Apr 2023 09:49:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D116A3858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681465744; bh=ZywofMMxQMHbplYq3ocd9f2quLQzOc0qXLrHvjBahsI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=oGSitWePmCScRLPFxFuKUY38mD+k+I5rdQw9oyluNd7OujInc/O9NsaZHkTnUJPco 4puDuB9CPT0ycZn62a9mEi5G9fnyLjQXXK5PmnokM5OX97DP7ng3M9oQwOxUE5QbGd WONLtIqeQMZtTl8ZJm2akOzIjuNmGI9TAQDrprtk= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109359] [12/13 Regression] Compile-time rounding of double literal to float is incorrect with -frounding-math Date: Fri, 14 Apr 2023 09:49:03 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.0 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: 12.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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109359 --- Comment #4 from Richard Biener --- (In reply to Jakub Jelinek from comment #3) > I think the fold-const.cc change is right though. > I wonder if for constant evaluation (constexpr, constinit) we shouldn't > arrange for those to be evaluated with temporarily -fno-rounding-math, I > think C uses > fold_init and its START_FOLD_INIT ... END_FOLD_INIT for this purpose.. > And otherwise perhaps we want dynamic initialization and do the conversion > at runtime? > Or disable the -frounding-math for all initializer folding? > What we emit is definitely wrong, > Variable which claims to have 8 bytes in size but actually has 16 under t= he > hood, with constants in different mode. We should have ICEd emitting the constant. And yes, I think -frounding-math should be disabled for constinit initializer folding (and possibly whether it is const or not should not depend on -frounding-math).=