public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-95226-4-wPAXrsb7Sg@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-95226-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95226

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:e7cc4d703bceb9095316c106eba0d1939c6c8044

commit r14-1498-ge7cc4d703bceb9095316c106eba0d1939c6c8044
Author: Jason Merrill <jason@redhat.com>
Date:   Thu Jun 1 14:41:07 2023 -0400

    varasm: check float size

    In PR95226, the testcase was failing because we tried to output_constant a
    NOP_EXPR to float from a double REAL_CST, and so we output a double where
    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 true
    for that NOP_EXPR, because it compared the sizes of integer types but not
    floating-point types.  So the C++ front end assumed it didn't need to fold
    the initializer.

            PR c++/95226

    gcc/ChangeLog:

            * varasm.cc (output_constant) [REAL_TYPE]: Check that sizes match.
            (initializer_constant_valid_p_1): Compare float precision.

  parent reply	other threads:[~2023-06-02 14:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19 23:30 [Bug c++/95226] New: " fboranek at atlas dot cz
2020-05-20  6:52 ` [Bug c++/95226] " fboranek at gmail dot com
2021-04-21  1:26 ` [Bug c++/95226] [8 Regression] " pinskia at gcc dot gnu.org
2021-05-14 13:39 ` jakub at gcc dot gnu.org
2021-05-14 14:27 ` jakub at gcc dot gnu.org
2021-05-14 14:31 ` cvs-commit at gcc dot gnu.org
2023-06-02 14:09 ` cvs-commit at gcc dot gnu.org [this message]
2024-02-05 22:25 ` cvs-commit at gcc dot gnu.org
2024-02-05 22:25 ` cvs-commit at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-95226-4-wPAXrsb7Sg@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).