From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8D2A838582B4; Mon, 5 Feb 2024 22:25:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8D2A838582B4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707171923; bh=6mvmxt95xEZ+ewi5cpVIytFmloTXfy9poKvacteHQW4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=YZUghgAT6OIzGHxxabeAgG8bZQDwymIjyrFXev+Zrvd4LPgxKUZUDvrnDWeyClh4a KFCNZeW4vu7XXnCUwkkmHe/yA/xALqX6GZyW8MmEJB+kGc4JpbSyy9eH/GQVbGP3TX HoRomNiyCyoiUap63OwDVtwV9O34gXsaRQMI5A5Q= From: "cvs-commit 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: Mon, 05 Feb 2024 22:25:22 +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: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: jason at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.4 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 #13 from GCC Commits --- The releases/gcc-13 branch has been updated by Jason Merrill : https://gcc.gnu.org/g:9b8e82ab45d1ad976a824cfd7c9bd2640c8bc8e3 commit r13-8282-g9b8e82ab45d1ad976a824cfd7c9bd2640c8bc8e3 Author: Jason Merrill Date: Thu Jun 1 14:41:07 2023 -0400 varasm: check float size [PR109359] In PR95226, the testcase was failing because we tried to output_constan= t a NOP_EXPR to float from a double REAL_CST, and so we output a double whe= re the caller wanted a float. That doesn't happen anymore, but with the output_constant hunk we will ICE in that situation rather than emit the wrong number of bytes. Part of the problem was that initializer_constant_valid_p_1 returned tr= ue for that NOP_EXPR, because it compared the sizes of integer types but n= ot floating-point types. So the C++ front end assumed it didn't need to f= old the initializer. This also fixed the test for PR109359. PR c++/95226 PR c++/109359 gcc/ChangeLog: * varasm.cc (output_constant) [REAL_TYPE]: Check that sizes mat= ch. (initializer_constant_valid_p_1): Compare float precision. gcc/testsuite/ChangeLog: * g++.dg/ext/frounding-math1.C: New test. (cherry picked from commit e7cc4d703bceb9095316c106eba0d1939c6c8044)=