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++/53932] [10 Regression] C++ reference variable to member of anonymous union in global is error
Date: Wed, 03 May 2023 15:20:43 +0000	[thread overview]
Message-ID: <bug-53932-4-PFpNQUOROe@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-53932-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #17 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:04cf6b57c7c467f615a16b7bbda574671e3fb2df

commit r10-11356-g04cf6b57c7c467f615a16b7bbda574671e3fb2df
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Jan 19 23:27:34 2023 +0100

    c++: Fix up handling of references to anon union members in initializers
[PR53932]

    For anonymous union members we create artificial VAR_DECLs which
    have DECL_VALUE_EXPR for the actual COMPONENT_REF.  That works
    just fine inside of functions (including global dynamic constructors),
    because during gimplification such VAR_DECLs are gimplified as
    their DECL_VALUE_EXPR.  This is also done during regimplification.

    But references to these artificial vars in DECL_INITIAL expressions
    aren't ever replaced by the DECL_VALUE_EXPRs, so we end up either
    with link failures like on the testcase below, or worse ICEs with
    LTO.

    The following patch fixes those during cp_fully_fold_init where we
    already walk all the trees (!data->genericize means that
    function rather than cp_fold_function).

    2023-01-19  Jakub Jelinek  <jakub@redhat.com>

            PR c++/53932
            * cp-gimplify.c (cp_fold_r): During cp_fully_fold_init replace
            DECL_ANON_UNION_VAR_P VAR_DECLs with their corresponding
            DECL_VALUE_EXPR.

            * g++.dg/init/pr53932.C: New test.

    (cherry picked from commit 9b9a989adc042b304572fd6d4ade46b47be6ccb8)

  parent reply	other threads:[~2023-05-03 15:20 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-12  2:55 [Bug c++/53932] New: [4.3 regression]C++ " nuller0222 at gmail dot com
2014-11-26 16:49 ` [Bug c++/53932] C++ " paolo.carlini at oracle dot com
2021-07-24 16:10 ` [Bug c++/53932] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
2021-09-22  7:41 ` pinskia at gcc dot gnu.org
2021-09-22  7:42 ` pinskia at gcc dot gnu.org
2022-01-17 15:24 ` rguenth at gcc dot gnu.org
2022-01-21 13:56 ` rguenth at gcc dot gnu.org
2022-05-27  9:34 ` [Bug c++/53932] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:30 ` jakub at gcc dot gnu.org
2023-01-19 13:58 ` rguenth at gcc dot gnu.org
2023-01-19 14:00 ` rguenth at gcc dot gnu.org
2023-01-19 14:09 ` jakub at gcc dot gnu.org
2023-01-19 16:51 ` jakub at gcc dot gnu.org
2023-01-19 17:30 ` jakub at gcc dot gnu.org
2023-01-19 22:28 ` cvs-commit at gcc dot gnu.org
2023-01-19 22:33 ` [Bug c++/53932] [10/11/12 " jakub at gcc dot gnu.org
2023-02-10 17:45 ` cvs-commit at gcc dot gnu.org
2023-02-10 17:55 ` [Bug c++/53932] [10/11 " jakub at gcc dot gnu.org
2023-05-02 20:13 ` cvs-commit at gcc dot gnu.org
2023-05-03  9:24 ` jakub at gcc dot gnu.org
2023-05-03 15:20 ` cvs-commit at gcc dot gnu.org [this message]
2023-05-04  7:15 ` [Bug c++/53932] [10 " jakub 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-53932-4-PFpNQUOROe@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).