]> git.ipfire.org Git - thirdparty/gcc.git/commit
d: Fix ICE in dwarf2out_imported_module_or_decl, at dwarf2out.cc:27676 [PR119817]
authorIain Buclaw <ibuclaw@gdcproject.org>
Tue, 15 Apr 2025 12:49:34 +0000 (14:49 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Sat, 19 Apr 2025 21:14:41 +0000 (23:14 +0200)
commitd1b7ee4879aca90c9828b6b9f4937ed15513adfa
treee1f007be901e0bc0e049d0f32d71729976f006be
parentaec3b99d3dee8a35adabb23c7835dfbd41e45520
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.

(cherry picked from commit f5ed7d19c965de9ccb158d77e929b17459bf65b5)
gcc/d/imports.cc
gcc/testsuite/gdc.dg/debug/imports/m119817/a.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/debug/imports/m119817/b.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/debug/imports/m119817/package.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/debug/pr119817.d [new file with mode: 0644]