This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [debug-early] Handle specification of class scoped static functions


On 04/03/2015 07:48 AM, Jason Merrill wrote:
On 03/20/2015 08:11 PM, Aldy Hernandez wrote:
+       /* For class scoped static functions, the dumped early
+          version was the declaration, whereas the next time
+          around with a different context should be the
+          specification.  In this case, avoid reusing the DIE, but
+          generate a specification below. E.g.:
+
+          class C {
+          public:
+            static void moo () {}
+          };  */
+       || !is_cu_die (context_die))

Why do we still need this added (relative to trunk)?  Are we getting
here multiple times with class context_die?

Apparently we no longer need it for the C++ case above, so the comment certainly needs updating, but we need it for fortran:

module some_m
contains
   logical function funky (FLAG)
     funky = .true.
  end function
end module

The first time through gen_subprogram_die() we generate the DIE with a context of DW_TAG_module (early dwarf). The second time, in late dwarf, we get here with a DW_TAG_module context again, so the above code will allow us to reuse the DIE, instead of creating a DW_AT_specification.

...or perhaps we could change the condition to:

      if ((is_cu_die (old_die->die_parent)
+	   || old_die->die_parent->die_tag == DW_TAG_module
	   || context_die == NULL

??
Aldy


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]