From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9AE853858C52; Mon, 5 Feb 2024 22:25:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9AE853858C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707171914; bh=KNCEEeU8Z7CmwKoDo4kwAx1sh51CkQ3R5rR4tQGhvzE=; h=From:To:Subject:Date:In-Reply-To:References:From; b=iPr7edJfYiJTBGJiRToep5g1u/gX5ZLmXtzAWSVZ/bhZlrKh3KVNZXXEcZWNZND0n Y4m3HLDqTji8JsyKtV7MpmwNIdwvEsDYgtIwTzL8A4Iw+4I4fzAWotH0ZPn/bi+7MZ deBp1PqmWhoHZyt1vLVsyIcCIVvB28tU19RChCRI= 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:10 +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 #12 from GCC Commits --- The releases/gcc-12 branch has been updated by Jason Merrill : https://gcc.gnu.org/g:470f501f31a4bdb9fa04c691ca7db2915ac3ae5b commit r12-10136-g470f501f31a4bdb9fa04c691ca7db2915ac3ae5b 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)=