aboutsummaryrefslogtreecommitdiff
path: root/gcc/d
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2025-04-15 14:49:34 +0200
committerIain Buclaw <ibuclaw@gdcproject.org>2025-04-15 15:04:13 +0200
commitf5ed7d19c965de9ccb158d77e929b17459bf65b5 (patch)
tree92ab9fc66415e9acac096b88dbf60fa12ae0cce7 /gcc/d
parentbf115fd45772de34cd24de02c41fdb175897f057 (diff)
downloadgcc-f5ed7d19c965de9ccb158d77e929b17459bf65b5.zip
gcc-f5ed7d19c965de9ccb158d77e929b17459bf65b5.tar.gz
gcc-f5ed7d19c965de9ccb158d77e929b17459bf65b5.tar.bz2
d: Fix ICE in dwarf2out_imported_module_or_decl, at dwarf2out.cc:27676 [PR119817]
The ImportVisitor method for handling the importing of overload sets was pushing NULL_TREE to the array of import decls, which in turn got passed to `debug_hooks->imported_module_or_decl', triggering the observed internal compiler error. NULL_TREE is returned from `build_import_decl' when the symbol was ignored for being non-trivial to represent in debug, for example, template or tuple declarations. So similarly "skip" adding the symbol when this is the case for overload sets too. PR d/119817 gcc/d/ChangeLog: * imports.cc (ImportVisitor::visit (OverloadSet *)): Don't push NULL_TREE to vector of import symbols. gcc/testsuite/ChangeLog: * gdc.dg/debug/imports/m119817/a.d: New test. * gdc.dg/debug/imports/m119817/b.d: New test. * gdc.dg/debug/imports/m119817/package.d: New test. * gdc.dg/debug/pr119817.d: New test.
Diffstat (limited to 'gcc/d')
-rw-r--r--gcc/d/imports.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/d/imports.cc b/gcc/d/imports.cc
index 776caaf..16e4df6 100644
--- a/gcc/d/imports.cc
+++ b/gcc/d/imports.cc
@@ -182,7 +182,11 @@ public:
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]));
+ {
+ tree overload = build_import_decl (d->a[i]);
+ if (overload != NULL_TREE)
+ vec_safe_push (tset, overload);
+ }
this->result_ = build_tree_list_vec (tset);
tset->truncate (0);