public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug d/98067] New: [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf
@ 2020-11-30  9:39 ibuclaw at gdcproject dot org
  2020-11-30  9:41 ` [Bug d/98067] " ibuclaw at gdcproject dot org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: ibuclaw at gdcproject dot org @ 2020-11-30  9:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98067

            Bug ID: 98067
           Summary: [11 Regression] d: ICE in in force_decl_die, at
                    dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: d
          Assignee: ibuclaw at gdcproject dot org
          Reporter: ibuclaw at gdcproject dot org
  Target Milestone: ---

Minimal test:

mman.d:
   enum MAP_ANON = 0x10;

test.d:
   import mman : MAP_ANON;

command:
   gdc -gdwarf-2 -gstrict-dwarf test.d

Have also tested with gdc-10 and gdc-9, and no ICE occurs.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug d/98067] [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf
  2020-11-30  9:39 [Bug d/98067] New: [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf ibuclaw at gdcproject dot org
@ 2020-11-30  9:41 ` ibuclaw at gdcproject dot org
  2020-11-30 10:00 ` ibuclaw at gdcproject dot org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: ibuclaw at gdcproject dot org @ 2020-11-30  9:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98067

Iain Buclaw <ibuclaw at gdcproject dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |98058
      Known to work|                            |10.2.1

--- Comment #1 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
Blocking pr98058, because darwin targets are strict dwarf2.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98058
[Bug 98058] libphobos: Support building on *-*-darwin*

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug d/98067] [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf
  2020-11-30  9:39 [Bug d/98067] New: [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf ibuclaw at gdcproject dot org
  2020-11-30  9:41 ` [Bug d/98067] " ibuclaw at gdcproject dot org
@ 2020-11-30 10:00 ` ibuclaw at gdcproject dot org
  2020-11-30 10:00 ` ibuclaw at gdcproject dot org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: ibuclaw at gdcproject dot org @ 2020-11-30 10:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98067

--- Comment #2 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
Backtrace:
0xaf0ca2 force_decl_die
        ../../gcc/dwarf2out.c:26197
0xae7bd6 force_decl_die
        ../../gcc/dwarf2out.c:26142
0xae7bd6 dwarf2out_imported_module_or_decl_1
        ../../gcc/dwarf2out.c:26809
0xb086a0 dwarf2out_imported_module_or_decl
        ../../gcc/dwarf2out.c:26895
0x9aabbe DeclVisitor::visit(Import*)
        ../../gcc/d/decl.cc:199
0x9a75af DeclVisitor::build_dsymbol(Dsymbol*)
        ../../gcc/d/decl.cc:145
0x9a75af build_decl_tree(Dsymbol*)
        ../../gcc/d/decl.cc:1015
0x9b9cc0 build_module_tree(Module*)
        ../../gcc/d/modules.cc:737
0x9aaa9b DeclVisitor::visit(Module*)
        ../../gcc/d/decl.cc:162
0x9a75af DeclVisitor::build_dsymbol(Dsymbol*)
        ../../gcc/d/decl.cc:145
0x9a75af build_decl_tree(Dsymbol*)
        ../../gcc/d/decl.cc:1015
0x9a4512 d_parse_file
        ../../gcc/d/d-lang.cc:1236
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug d/98067] [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf
  2020-11-30  9:39 [Bug d/98067] New: [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf ibuclaw at gdcproject dot org
  2020-11-30  9:41 ` [Bug d/98067] " ibuclaw at gdcproject dot org
  2020-11-30 10:00 ` ibuclaw at gdcproject dot org
@ 2020-11-30 10:00 ` ibuclaw at gdcproject dot org
  2020-11-30 10:04 ` iains at gcc dot gnu.org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: ibuclaw at gdcproject dot org @ 2020-11-30 10:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98067

--- Comment #3 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
It looks like the regressing change was r11-5003.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug d/98067] [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf
  2020-11-30  9:39 [Bug d/98067] New: [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf ibuclaw at gdcproject dot org
                   ` (2 preceding siblings ...)
  2020-11-30 10:00 ` ibuclaw at gdcproject dot org
@ 2020-11-30 10:04 ` iains at gcc dot gnu.org
  2020-11-30 11:29 ` ibuclaw at gdcproject dot org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: iains at gcc dot gnu.org @ 2020-11-30 10:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98067

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-11-30
                 CC|                            |iains at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug d/98067] [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf
  2020-11-30  9:39 [Bug d/98067] New: [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf ibuclaw at gdcproject dot org
                   ` (3 preceding siblings ...)
  2020-11-30 10:04 ` iains at gcc dot gnu.org
@ 2020-11-30 11:29 ` ibuclaw at gdcproject dot org
  2020-11-30 11:45 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: ibuclaw at gdcproject dot org @ 2020-11-30 11:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98067

--- Comment #4 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
What fails is gen_decl_die()

---
 case CONST_DECL:
─> if (!is_fortran () && !is_ada () && !is_dlang ())
     {
       /* The individual enumerators of an enum type get output when we output
          the Dwarf representation of the relevant enum type itself.  */
       break;
     }

   /* Emit its type.  */
   gen_type_die (TREE_TYPE (decl), context_die);

   /* And its containing namespace.  */
   context_die = declare_in_namespace (decl, context_die);

   gen_const_die (decl, context_die);
   break;
---

Here, the condition `!is_dlang ()` returns true because DW_LANG_D does not
exist in DWARFv2.

Would it be correct to fallback on a lang_hooks.name comparison if
dwarf_version < 2?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug d/98067] [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf
  2020-11-30  9:39 [Bug d/98067] New: [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf ibuclaw at gdcproject dot org
                   ` (4 preceding siblings ...)
  2020-11-30 11:29 ` ibuclaw at gdcproject dot org
@ 2020-11-30 11:45 ` rguenth at gcc dot gnu.org
  2020-11-30 11:45 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-11-30 11:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98067

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Iain Buclaw from comment #4)
> What fails is gen_decl_die()
> 
> ---
>  case CONST_DECL:
> ─> if (!is_fortran () && !is_ada () && !is_dlang ())
>      {
>        /* The individual enumerators of an enum type get output when we
> output
>           the Dwarf representation of the relevant enum type itself.  */
>        break;
>      }
> 
>    /* Emit its type.  */
>    gen_type_die (TREE_TYPE (decl), context_die);
> 
>    /* And its containing namespace.  */
>    context_die = declare_in_namespace (decl, context_die);
>  
>    gen_const_die (decl, context_die);
>    break;
> ---
> 
> Here, the condition `!is_dlang ()` returns true because DW_LANG_D does not
> exist in DWARFv2.
> 
> Would it be correct to fallback on a lang_hooks.name comparison if
> dwarf_version < 2?

I wonder if we can instead "delay" applying "strict dwarf" to the actual
output of DW_AT_language.  I mean, with DWARF2 there should be no debug
for D at all since you can't specify the source language ...

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug d/98067] [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf
  2020-11-30  9:39 [Bug d/98067] New: [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf ibuclaw at gdcproject dot org
                   ` (5 preceding siblings ...)
  2020-11-30 11:45 ` rguenth at gcc dot gnu.org
@ 2020-11-30 11:45 ` rguenth at gcc dot gnu.org
  2020-11-30 13:55 ` iains at gcc dot gnu.org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-11-30 11:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98067

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.0

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug d/98067] [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf
  2020-11-30  9:39 [Bug d/98067] New: [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf ibuclaw at gdcproject dot org
                   ` (6 preceding siblings ...)
  2020-11-30 11:45 ` rguenth at gcc dot gnu.org
@ 2020-11-30 13:55 ` iains at gcc dot gnu.org
  2020-11-30 14:12 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: iains at gcc dot gnu.org @ 2020-11-30 13:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98067

--- Comment #6 from Iain Sandoe <iains at gcc dot gnu.org> ---
although this was discovered on Darwin, I guess any platform supporting D could
be invoked with -gdwarf-2 and that ought not to ICE.

I suppose we could adjust configury to decline building D without DWARF >= 3
support.

( I plan to add some support for detecting this for Darwin, system versions
with LLDB and dsymutil from LLVM are capable of supporting DWARF-4 - and maybe
some earlier cases do support DWARF-3 .. )

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug d/98067] [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf
  2020-11-30  9:39 [Bug d/98067] New: [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf ibuclaw at gdcproject dot org
                   ` (7 preceding siblings ...)
  2020-11-30 13:55 ` iains at gcc dot gnu.org
@ 2020-11-30 14:12 ` jakub at gcc dot gnu.org
  2020-11-30 16:00 ` ibuclaw at gdcproject dot org
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-11-30 14:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98067

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #5)
> > Would it be correct to fallback on a lang_hooks.name comparison if
> > dwarf_version < 2?
> 
> I wonder if we can instead "delay" applying "strict dwarf" to the actual
> output of DW_AT_language.  I mean, with DWARF2 there should be no debug
> for D at all since you can't specify the source language ...

I think that would be quite problematic, because we earlier decide on the
abbreviation for it, consider it for sizes etc. and all that is from the exact
value, which could be different.
Using lang_hooks.name is problematic too, that would be GNU GIMPLE for lto...
Though maybe we don't need it during late dwarf at all.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug d/98067] [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf
  2020-11-30  9:39 [Bug d/98067] New: [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf ibuclaw at gdcproject dot org
                   ` (8 preceding siblings ...)
  2020-11-30 14:12 ` jakub at gcc dot gnu.org
@ 2020-11-30 16:00 ` ibuclaw at gdcproject dot org
  2020-12-07  7:28 ` ibuclaw at gdcproject dot org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: ibuclaw at gdcproject dot org @ 2020-11-30 16:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98067

--- Comment #8 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
As a last resort I could just not emit D manifest constants as CONST_DECLs. 
They are a nice-to-have from the debugger, but functionally equivalent to C
macros.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug d/98067] [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf
  2020-11-30  9:39 [Bug d/98067] New: [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf ibuclaw at gdcproject dot org
                   ` (9 preceding siblings ...)
  2020-11-30 16:00 ` ibuclaw at gdcproject dot org
@ 2020-12-07  7:28 ` ibuclaw at gdcproject dot org
  2020-12-19 21:15 ` cvs-commit at gcc dot gnu.org
  2020-12-19 21:17 ` ibuclaw at gdcproject dot org
  12 siblings, 0 replies; 14+ messages in thread
From: ibuclaw at gdcproject dot org @ 2020-12-07  7:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98067

--- Comment #9 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
(In reply to Iain Buclaw from comment #8)
> As a last resort I could just not emit D manifest constants as CONST_DECLs. 
> They are a nice-to-have from the debugger, but functionally equivalent to C
> macros.

Or would it be better represent D manifest constants as being part of an
anonymous enum type internally?

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug d/98067] [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf
  2020-11-30  9:39 [Bug d/98067] New: [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf ibuclaw at gdcproject dot org
                   ` (10 preceding siblings ...)
  2020-12-07  7:28 ` ibuclaw at gdcproject dot org
@ 2020-12-19 21:15 ` cvs-commit at gcc dot gnu.org
  2020-12-19 21:17 ` ibuclaw at gdcproject dot org
  12 siblings, 0 replies; 14+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-12-19 21:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98067

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain Buclaw <ibuclaw@gcc.gnu.org>:

https://gcc.gnu.org/g:e9e4ddfc5abbf9ee5e657d626264cef89f10b4c3

commit r11-6270-ge9e4ddfc5abbf9ee5e657d626264cef89f10b4c3
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Wed Dec 16 00:17:40 2020 +0100

    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.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Bug d/98067] [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf
  2020-11-30  9:39 [Bug d/98067] New: [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf ibuclaw at gdcproject dot org
                   ` (11 preceding siblings ...)
  2020-12-19 21:15 ` cvs-commit at gcc dot gnu.org
@ 2020-12-19 21:17 ` ibuclaw at gdcproject dot org
  12 siblings, 0 replies; 14+ messages in thread
From: ibuclaw at gdcproject dot org @ 2020-12-19 21:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98067

Iain Buclaw <ibuclaw at gdcproject dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #11 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
Fix committed.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2020-12-19 21:17 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-30  9:39 [Bug d/98067] New: [11 Regression] d: ICE in in force_decl_die, at dwarf2out.c:26197 with -gdwarf-2 -gstrict-dwarf ibuclaw at gdcproject dot org
2020-11-30  9:41 ` [Bug d/98067] " ibuclaw at gdcproject dot org
2020-11-30 10:00 ` ibuclaw at gdcproject dot org
2020-11-30 10:00 ` ibuclaw at gdcproject dot org
2020-11-30 10:04 ` iains at gcc dot gnu.org
2020-11-30 11:29 ` ibuclaw at gdcproject dot org
2020-11-30 11:45 ` rguenth at gcc dot gnu.org
2020-11-30 11:45 ` rguenth at gcc dot gnu.org
2020-11-30 13:55 ` iains at gcc dot gnu.org
2020-11-30 14:12 ` jakub at gcc dot gnu.org
2020-11-30 16:00 ` ibuclaw at gdcproject dot org
2020-12-07  7:28 ` ibuclaw at gdcproject dot org
2020-12-19 21:15 ` cvs-commit at gcc dot gnu.org
2020-12-19 21:17 ` ibuclaw at gdcproject dot org

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).