From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D900F385842D; Mon, 5 Feb 2024 22:25:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D900F385842D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707171922; bh=PpC45Or9J683eF2nl1XtZYe3cUQeT/yJukiT5AQz2Fw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=JCpcz1yOI4oTsIiJW99/snhosziaYyhbSWb8116mt+dtF8iaVtvv9gldQSILa2gin BUkcrJpCtJiDRgsiGUlJvq80gMfoD59hkNwj1gzPtGkMh73a7SuRZW5FcLLdDNsJr2 IelNbMII3RO8o0joGHh8PpXvRs58yhQRus4dCNbo= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/95226] [8 Regression] Faulty aggregate initialization of vector with struct with float 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: 8.3.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 9.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=3D95226 --- Comment #7 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)=