public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Iain Buclaw <ibuclaw@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-10415] d: Fix internal compiler error: in visit, at d/imports.cc:72 (PR108050) Date: Sun, 11 Dec 2022 18:00:25 +0000 (GMT) [thread overview] Message-ID: <20221211180025.E8ABB387721F@sourceware.org> (raw) https://gcc.gnu.org/g:40b5a2354b58955aef168104c173311f062f1fa5 commit r11-10415-g40b5a2354b58955aef168104c173311f062f1fa5 Author: Iain Buclaw <ibuclaw@gdcproject.org> Date: Sat Dec 10 19:12:43 2022 +0100 d: Fix internal compiler error: in visit, at d/imports.cc:72 (PR108050) The visitor for lowering IMPORTED_DECLs did not have an override for dealing with importing OverloadSet symbols. This has now been implemented in the code generator. PR d/108050 gcc/d/ChangeLog: * decl.cc (DeclVisitor::visit (Import *)): Handle build_import_decl returning a TREE_LIST. * imports.cc (ImportVisitor::visit (OverloadSet *)): New override. gcc/testsuite/ChangeLog: * gdc.dg/imports/pr108050/mod1.d: New. * gdc.dg/imports/pr108050/mod2.d: New. * gdc.dg/imports/pr108050/package.d: New. * gdc.dg/pr108050.d: New test. (cherry picked from commit d9d8c9674ad3ad3aa38419d24b1aaaffe31f5d3f) Diff: --- gcc/d/decl.cc | 12 ++++++++++-- gcc/d/imports.cc | 14 ++++++++++++++ gcc/testsuite/gdc.dg/imports/pr108050/mod1.d | 2 ++ gcc/testsuite/gdc.dg/imports/pr108050/mod2.d | 2 ++ gcc/testsuite/gdc.dg/imports/pr108050/package.d | 2 ++ gcc/testsuite/gdc.dg/pr108050.d | 4 ++++ 6 files changed, 34 insertions(+), 2 deletions(-) diff --git a/gcc/d/decl.cc b/gcc/d/decl.cc index a30549ce8e0..fff7a7c2a74 100644 --- a/gcc/d/decl.cc +++ b/gcc/d/decl.cc @@ -197,8 +197,16 @@ public: tree name = (alias != NULL) ? get_identifier (alias->toChars ()) : NULL_TREE; - debug_hooks->imported_module_or_decl (decl, name, context, - false, false); + if (TREE_CODE (decl) != TREE_LIST) + debug_hooks->imported_module_or_decl (decl, name, context, + false, false); + else + { + /* Overload sets return a list of imported decls. */ + for (; decl != NULL_TREE; decl = TREE_CHAIN (decl)) + debug_hooks->imported_module_or_decl (TREE_VALUE (decl), name, + context, false, false); + } } } else diff --git a/gcc/d/imports.cc b/gcc/d/imports.cc index 2288843c61a..399c3ee3d25 100644 --- a/gcc/d/imports.cc +++ b/gcc/d/imports.cc @@ -157,6 +157,20 @@ public: } } + /* Build IMPORTED_DECLs for all overloads in a set. */ + void visit (OverloadSet *d) + { + vec<tree, va_gc> *tset = NULL; + + vec_alloc (tset, d->a.length); + + for (size_t i = 0; i < d->a.length; i++) + vec_safe_push (tset, build_import_decl (d->a[i])); + + d->isym = build_tree_list_vec (tset); + tset->truncate (0); + } + /* Function aliases are the same as alias symbols. */ void visit (FuncAliasDeclaration *d) { diff --git a/gcc/testsuite/gdc.dg/imports/pr108050/mod1.d b/gcc/testsuite/gdc.dg/imports/pr108050/mod1.d new file mode 100644 index 00000000000..f27a13dc051 --- /dev/null +++ b/gcc/testsuite/gdc.dg/imports/pr108050/mod1.d @@ -0,0 +1,2 @@ +module imports.pr108050.mod1; +string[] split() { return null; } diff --git a/gcc/testsuite/gdc.dg/imports/pr108050/mod2.d b/gcc/testsuite/gdc.dg/imports/pr108050/mod2.d new file mode 100644 index 00000000000..29d8aa8f53e --- /dev/null +++ b/gcc/testsuite/gdc.dg/imports/pr108050/mod2.d @@ -0,0 +1,2 @@ +module imports.pr108050.mod2; +string[] split() { return null; } diff --git a/gcc/testsuite/gdc.dg/imports/pr108050/package.d b/gcc/testsuite/gdc.dg/imports/pr108050/package.d new file mode 100644 index 00000000000..b8b03b832af --- /dev/null +++ b/gcc/testsuite/gdc.dg/imports/pr108050/package.d @@ -0,0 +1,2 @@ +module imports.pr108050; +public import imports.pr108050.mod1, imports.pr108050.mod2; diff --git a/gcc/testsuite/gdc.dg/pr108050.d b/gcc/testsuite/gdc.dg/pr108050.d new file mode 100644 index 00000000000..69134e73137 --- /dev/null +++ b/gcc/testsuite/gdc.dg/pr108050.d @@ -0,0 +1,4 @@ +// { dg-do compile } +// { dg-additional-sources "imports/pr108050/package.d imports/pr108050/mod1.d imports/pr108050/mod2.d" } +// { dg-options "-g" } +import imports.pr108050 : split;
reply other threads:[~2022-12-11 18:00 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=20221211180025.E8ABB387721F@sourceware.org \ --to=ibuclaw@gcc.gnu.org \ --cc=gcc-cvs@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: linkBe 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).