d: Fix ICE in in force_decl_die, at dwarf2out.c with -gdwarf-2 -gstrict-dwarf [PR98067]
Manifest constants in D are represented as CONST_DECLs, which can be imported from one module to another. However, when compiling on strict dwarf2 targets such as *-*-darwin10, importing CONST_DECLs cannot be represented in debug as D did not exist as an AT_language until dwarf3, and the only available fallback being DW_LANG_C. As CONST_DECLs are treated as enumerators in C, and not outputted individually in gen_decl_die, this causes an internal error in force_decl_die to occur. To handle this, similar to other places in dwarf2out, if a CONST_DECL is seen in dwarf2out_imported_module_or_decl_1, then we simply return early if the language is not one of Ada, D, or Fortran. gcc/ChangeLog: PR d/98067 * dwarf2out.c (dwarf2out_imported_module_or_decl_1): Handle CONST_DECL only if is_fortran, is_ada, or is_dlang. gcc/testsuite/ChangeLog: PR d/98067 * gdc.dg/debug/debug.exp: New test. * gdc.dg/debug/dwarf2/dwarf2.exp: New test. * gdc.dg/debug/dwarf2/imports/pr98067.d: New test. * gdc.dg/debug/dwarf2/langdw2.d: New test. * gdc.dg/debug/dwarf2/langdw3.d: New test. * gdc.dg/debug/dwarf2/pr98067.d: New test. * gdc.dg/debug/trivial.d: New test.
Showing
- gcc/dwarf2out.c 7 additions, 0 deletionsgcc/dwarf2out.c
- gcc/testsuite/gdc.dg/debug/debug.exp 28 additions, 0 deletionsgcc/testsuite/gdc.dg/debug/debug.exp
- gcc/testsuite/gdc.dg/debug/dwarf2/dwarf2.exp 31 additions, 0 deletionsgcc/testsuite/gdc.dg/debug/dwarf2/dwarf2.exp
- gcc/testsuite/gdc.dg/debug/dwarf2/imports/pr98067.d 3 additions, 0 deletionsgcc/testsuite/gdc.dg/debug/dwarf2/imports/pr98067.d
- gcc/testsuite/gdc.dg/debug/dwarf2/langdw2.d 7 additions, 0 deletionsgcc/testsuite/gdc.dg/debug/dwarf2/langdw2.d
- gcc/testsuite/gdc.dg/debug/dwarf2/langdw3.d 6 additions, 0 deletionsgcc/testsuite/gdc.dg/debug/dwarf2/langdw3.d
- gcc/testsuite/gdc.dg/debug/dwarf2/pr98067.d 6 additions, 0 deletionsgcc/testsuite/gdc.dg/debug/dwarf2/pr98067.d
- gcc/testsuite/gdc.dg/debug/trivial.d 6 additions, 0 deletionsgcc/testsuite/gdc.dg/debug/trivial.d
Loading
Please register or sign in to comment