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: PR22034


Jan Hubicka wrote:
Jan Hubicka wrote:

Hi,
The problem is that statics inside classes have TYPEs as contextes. I think
proper fix is to unwind them up to the containing scope.


Bootstrapped/regtested i686-pc-gnu-linux, OK?

/* For local statics lookup proper context die. */
if (TREE_STATIC (decl) && decl_function_context (decl))
! {
! tree context = DECL_CONTEXT (decl);
! ! while (TYPE_P (context))
! context = TYPE_CONTEXT (context);
! context_die = lookup_decl_die (context);
! }

Note that you can then end up with a FUNCTION_DECL as the context again. Like:


 void f() {
  struct S {
    void g() {
      struct T {
        virtual void f();
      };
    }
  }
}

The virtual table for T will be inside lots of things.

So, don't you need to iterate on both conditions?


Well, I think that in this case the context I should put f() in is g's
internal scope, but perhaps I am wrong here - dwarf is definitly not my
domain :(
I will try to check this out tomorrow unless someone more aware of the
detials explains it...

If you have that flexibility, why not put it directly in T? That's where it really belongs!


--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com
(916) 791-8304


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