fix for -O3 -g testsuite failures for dwarf2 targets

Mark Mitchell mark@codesourcery.com
Wed Oct 20 16:43:00 GMT 1999


>>>>> "Jim" == Jim Wilson <wilson@cygnus.com> writes:

    Jim> Targets using DWARF2 have new gcc testsuite failures at -O3
    Jim> -g.  The culprit is this change.

    Jim> Wed Sep 15 21:37:06 1999 Mark Mitchell
    Jim> <mark@codesourcery.com>

    Jim> 	* integrate.c (integrate_decl_tree): Don't use
    Jim> pushlevel, pushdecl, or poplevel to build up the new BLOCK
    Jim> tree.

Thanks for spotting this.  I don't usually run the C tests in
DWARF2-land, so I missed this.

    Jim> The new code unconditionally sets DECL_CONTEXT.  This seems
    Jim> wrong.

Yes.  My bad.

    Jim> Unfortunately, every front end sets DECL_CONTEXT slightly
    Jim> differently, so we may need a new front end callback to get
    Jim> this right.  For now, I just use the C version of the
    Jim> DECL_CONTEXT code from pushdecl.

The DECL_CONTEXTs for these inlined thingys shouldn't have any
semantic content for the front-ends.  In fact, they should never see
the declarations again; this is all back-end machination.  So, we
should be able to do one thing for all front-ends.  After all, our
debug-info generation is front-end independent (almost) and that's all
these declarations will be used for.

Certainly, things without context should remain without context.  They
are globals.  Some things with context should probably keep their old
context.  (Like static data members of classes.  You can't declare
these in function-scope in C++, but in principle, such a language
might exist.)  Then, function-local statics ought to keep their
original scope, too, I think.

  if (!DECL_CONTEXT (t))
    /* Globals stay global.  */
    ;
  else if (DECL_CONTEXT (t) != <function from which inlining is ocurring>)
    /* Things that weren't in the scope of the function we're inlining
       from aren't in the scope we're inlining too, either.  */
    ;
  else if (TREE_STATIC (t))
    /* Function-scoped static variables should stay in the original
       function.  */
    ;
  else
    /* Ordinary local variables are now in the scope of the new
       function.  */
    DECL_CONTEXT (t) = DECL_CONTEXT (d);

What do you think?

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com


More information about the Gcc-patches mailing list