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

--- Comment #12 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #11)
> OK, so patch at least regresses
> 
> FAIL: g++.dg/debug/dwarf2/lambda1.C  -std=gnu++11  scan-assembler-times
> DW_TAG_variable[^.]*.ascii "this.0" 2
> FAIL: g++.dg/debug/dwarf2/lambda1.C  -std=gnu++14  scan-assembler-times
> DW_TAG_variable[^.]*.ascii "this.0" 2
> 
> but otherwise passes LTO bootstrap.  Have to investigate the above tomorrow.

The reason is that in the late phase we fail DIE re-use and instead generate
a specification DIE because

      if (((is_unit_die (old_die->die_parent)
            /* This condition fixes the inconsistency/ICE with the
               following Fortran test (or some derivative thereof) while
               building libgfortran:

                  module some_m
                  contains
                     logical function funky (FLAG)
                       funky = .true.
                    end function
                  end module
             */
            || (old_die->die_parent
                && old_die->die_parent->die_tag == DW_TAG_module)
            || context_die == NULL)
...
          subr_die = old_die;

triggers only because of context_die == NULL.  This is a funky area
but the comment "For local class methods, this doesn't apply; we just use the
old DIE." suggests

            || local_scope_p (old_die->die_parent)

pre early-debug merge already had the context_die == NULL check which
_possibly_ was supposed to match that comment.

Reply via email to