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++/112820] vtable not emitted correctly from module when compiling with -g
Date: Tue, 23 Jan 2024 09:46:29 +0000	[thread overview]
Message-ID: <bug-112820-4-v6ioACDTOc@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-112820-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Nathaniel Shead <nshead@gcc.gnu.org>:

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

commit r14-8350-gaffef534b0335592336c82918f15242576e2ab8f
Author: Nathaniel Shead <nathanieloshead@gmail.com>
Date:   Wed Jan 17 16:50:39 2024 +1100

    c++: Fix handling of extern templates in modules [PR112820]

    Currently, extern templates are detected by looking for the
    DECL_EXTERNAL flag on a TYPE_DECL. However, this is incorrect:
    TYPE_DECLs don't actually set this flag, and it happens to work by
    coincidence due to TYPE_DECL_SUPPRESS_DEBUG happening to use the same
    underlying bit. This however causes issues with other TYPE_DECLs that
    also happen to have suppressed debug information.

    Instead, this patch reworks the logic so CLASSTYPE_INTERFACE_ONLY is
    always emitted into the module BMI and can then be used to check for an
    extern template correctly.

    Otherwise, for other declarations we always want to redetermine this:
    even for declarations from the GMF, we may change our mind on whether to
    import or export depending on decisions made later in the TU after
    importing so we shouldn't decide this now, or necessarily reuse what the
    module we'd imported had decided.

    Some of this may need to change in the future to account for
    https://github.com/itanium-cxx-abi/cxx-abi/issues/170.

            PR c++/112820
            PR c++/102607

    gcc/cp/ChangeLog:

            * module.cc (trees_out::lang_type_bools): Write interface_only
            and interface_unknown.
            (trees_in::lang_type_bools): Read the above flags.
            (trees_in::decl_value): Reset CLASSTYPE_INTERFACE_* except for
            extern templates.
            (trees_in::read_class_def): Remove buggy extern template
            handling.

    gcc/testsuite/ChangeLog:

            * g++.dg/modules/debug-2_a.C: New test.
            * g++.dg/modules/debug-2_b.C: New test.
            * g++.dg/modules/debug-2_c.C: New test.
            * g++.dg/modules/debug-3_a.C: New test.
            * g++.dg/modules/debug-3_b.C: New test.

    Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>

  parent reply	other threads:[~2024-01-23  9:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-02  1:38 [Bug c++/112820] New: " michael.kenzel at gmail dot com
2023-12-02 12:31 ` [Bug c++/112820] " nathanieloshead at gmail dot com
2023-12-04  7:00 ` rguenth at gcc dot gnu.org
2024-01-23  9:46 ` cvs-commit at gcc dot gnu.org [this message]
2024-01-27 10:26 ` nshead 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-112820-4-v6ioACDTOc@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).