From: Iain Buclaw <ibuclaw@gdcproject.org>
To: gcc-patches@gcc.gnu.org
Subject: [committed] d: Build internal TypeInfo types when module name is "object"
Date: Mon, 15 Aug 2022 21:46:28 +0200 [thread overview]
Message-ID: <20220815194628.2361568-1-ibuclaw@gdcproject.org> (raw)
Hi,
This patch is a fix-up for a previous change in r13-1070.
If for whatever reason the module declaration doesn't exist in the
object file, ensure that the internal definitions for TypeInfo and
TypeInfo_Class are still created, otherwise an ICE could occur later if
they are required for a run-time helper call.
Regression tested on x86_64-linux-gnu, and committed to mainline.
Regards,
Iain.
---
gcc/d/ChangeLog:
* d-compiler.cc (Compiler::onParseModule): Call create_tinfo_types
when module name is object.
* typeinfo.cc (create_tinfo_types): Add guard for multiple
invocations.
---
gcc/d/d-compiler.cc | 11 +++++++++--
gcc/d/typeinfo.cc | 4 ++++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/gcc/d/d-compiler.cc b/gcc/d/d-compiler.cc
index ada9721541b..ef19df12437 100644
--- a/gcc/d/d-compiler.cc
+++ b/gcc/d/d-compiler.cc
@@ -130,8 +130,7 @@ Compiler::onParseModule (Module *m)
{
if (md->packages.length == 0)
{
- Identifier *id = (md && md->id) ? md->id : m->ident;
- if (!strcmp (id->toChars (), "object"))
+ if (!strcmp (md->id->toChars (), "object"))
{
create_tinfo_types (m);
return;
@@ -147,6 +146,14 @@ Compiler::onParseModule (Module *m)
}
}
}
+ else if (m->ident)
+ {
+ if (!strcmp (m->ident->toChars (), "object"))
+ {
+ create_tinfo_types (m);
+ return;
+ }
+ }
if (!flag_no_builtin)
d_add_builtin_module (m);
diff --git a/gcc/d/typeinfo.cc b/gcc/d/typeinfo.cc
index d1f0d59952f..3577f669ed1 100644
--- a/gcc/d/typeinfo.cc
+++ b/gcc/d/typeinfo.cc
@@ -244,6 +244,10 @@ make_frontend_typeinfo (Identifier *ident, ClassDeclaration *base = NULL)
void
create_tinfo_types (Module *mod)
{
+ /* Already generated internal types for the object module. */
+ if (object_module != NULL)
+ return;
+
/* Build the internal TypeInfo and ClassInfo types.
See TypeInfoVisitor for documentation of field layout. */
make_internal_typeinfo (TK_TYPEINFO_TYPE, Identifier::idPool ("TypeInfo"),
--
2.34.1
reply other threads:[~2022-08-15 19:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220815194628.2361568-1-ibuclaw@gdcproject.org \
--to=ibuclaw@gdcproject.org \
--cc=gcc-patches@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).