From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 014AE385770C; Fri, 2 Jun 2023 14:09:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 014AE385770C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685714968; bh=aanNYwk1dsTXsDfvslbQNHBqqXbspbd8fQDF2umX35s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=jpPQe4R1FcGcX54CuoeEq9qmw8FNZbZow8DC/tCVv4rkqb7FUXEA//2mtE1AuQtot WfatiLNHsg718A04Qqo3xO2gxC7x085bLJD9dA2Zz6kSDZ9mnNUxLf4Le9tNeZtOqn wJNuNfYuuHi36Sd6Mk2iu3o34xe106jOHcfr8h8Q= 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: Fri, 02 Jun 2023 14:09:27 +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 #5 from CVS Commits --- The trunk branch has been updated by Jason Merrill : https://gcc.gnu.org/g:e7cc4d703bceb9095316c106eba0d1939c6c8044 commit r14-1498-ge7cc4d703bceb9095316c106eba0d1939c6c8044 Author: Jason Merrill Date: Thu Jun 1 14:41:07 2023 -0400 varasm: check float size 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. PR c++/95226 gcc/ChangeLog: * varasm.cc (output_constant) [REAL_TYPE]: Check that sizes mat= ch. (initializer_constant_valid_p_1): Compare float precision.=