From: Jason Merrill <jason@redhat.com>
To: Patrick Palka <ppalka@redhat.com>,
Nathaniel Shead <nathanieloshead@gmail.com>
Cc: gcc-patches@gcc.gnu.org, Nathan Sidwell <nathan@acm.org>
Subject: Re: [PATCH v2] c++/modules: Differentiate extern templates and TYPE_DECL_SUPPRESS_DEBUG [PR112820]
Date: Mon, 15 Jan 2024 18:10:55 -0500 [thread overview]
Message-ID: <7c45785c-f1e4-4e90-9a41-497433b7d5f7@redhat.com> (raw)
In-Reply-To: <6dc0c70c-1e12-275b-aff0-f06c42786bb0@idea>
On 1/8/24 10:27, Patrick Palka wrote:
> On Mon, 8 Jan 2024, Nathaniel Shead wrote:
>> On Thu, Jan 04, 2024 at 03:39:15PM -0500, Patrick Palka wrote:
>>> On Sun, 3 Dec 2023, Nathaniel Shead wrote:
>>>>
>>>> The TYPE_DECL_SUPPRESS_DEBUG and DECL_EXTERNAL flags use the same
>>>> underlying bit. This is causing confusion when attempting to determine
>>>> the interface for a streamed-in class type, since the modules code
>>>> currently assumes that all DECL_EXTERNAL types are extern templates.
>>>> However, when -g is specified then TYPE_DECL_SUPPRESS_DEBUG (and hence
>>>> DECL_EXTERNAL) is marked on various other kinds of declarations, such as
>>>> vtables, which causes them to never be emitted.
But a vtable isn't a TYPE_DECL?
I suspect what you mean is that maybe_suppress_debug_info is setting
TYPE_DECL_SUPPRESS_DEBUG to try to avoid duplication of debug info for
classes with vtables, and then the modules code is wrongly assuming that
you can check DECL_EXTERNAL for TYPE_DECL, and that it's set only if
CLASSTYPE_INTERFACE_ONLY is also set, which is wrong in this case, so we
avoid emitting the vtable or anything else for that class.
It seems unnecessary to start setting DECL_EXTERNAL on the TYPE_DECL to
mean the exact same thing as CLASSTYPE_INTERFACE_ONLY. Rather, the
modules code should stop trying to check DECL_EXTERNAL on a TYPE_DECL.
Under what circumstances does it make sense for CLASSTYPE_INTERFACE_ONLY
to be set in the context of modules, anyway? We probably want to
propagate it for things in the global module so that various libstdc++
explicit instantiations work the same with import std.
For an class imported from a named module, this ties into the earlier
discussion about vtables and inlines that hasn't resolved yet in the ABI
committee. But it's certainly significantly interface-like. And I
would expect maybe_suppress_debug_info to suppress the debug info for
such a class on the assumption that the module unit has the needed debug
info.
Jason
next prev parent reply other threads:[~2024-01-15 23:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-03 12:46 [PATCH] c++/modules: Prevent treating suppressed debug info as extern template [PR112820] Nathaniel Shead
2024-01-02 22:52 ` Nathaniel Shead
2024-01-04 20:39 ` Patrick Palka
2024-01-08 9:57 ` [PATCH v2] c++/modules: Differentiate extern templates and TYPE_DECL_SUPPRESS_DEBUG [PR112820] Nathaniel Shead
2024-01-08 11:50 ` Richard Biener
2024-01-08 15:27 ` Patrick Palka
2024-01-15 23:10 ` Jason Merrill [this message]
2024-01-16 12:14 ` Nathaniel Shead
2024-01-17 6:33 ` [PATCH v3] c++/modules: Fix handling of extern templates in modules [PR112820] Nathaniel Shead
2024-01-17 15:51 ` Jason Merrill
2024-01-22 11:04 ` Nathaniel Shead
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=7c45785c-f1e4-4e90-9a41-497433b7d5f7@redhat.com \
--to=jason@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=nathan@acm.org \
--cc=nathanieloshead@gmail.com \
--cc=ppalka@redhat.com \
/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).