Hello,

we've just noticed a quite serious regression in debug info output
in GCC 4.0 over previous releases: when building with -funit-at-a-time
(which is on by default with -O2), *no* debug info for global variables
appears to be emitted at all.

The problem appears to be this piece of code in check_global_declarations:

      /* Do not emit debug information about variables that are in
         static storage, but not defined.  */
      if (TREE_CODE (decl) == VAR_DECL
          && TREE_STATIC (decl)
          && !TREE_ASM_WRITTEN (decl))
        DECL_IGNORED_P (decl) = 1;

which was added by:
http://gcc.gnu.org/ml/gcc-cvs/2004-11/msg01250.html

2004-11-25  Mark Mitchell  <[EMAIL PROTECTED]>

        PR c++/18556
        * toplev.c (check_global_declarations): Set DECL_IGNORED_P on
        unemitted variables with static storage duration.


However, check_global_declarations is called (by the C front-end at least)
*before* the call to cgraph_optimize.  At this time, when -funit-at-a-time
is in effect, *no* variables have been emitted to assembler as far as I
can tell, and thus all global variables get the DECL_IGNORED_P flag.

Interestingly enough, when building with the C++ front-end, the debug
info is properly emitted.  I'm not sure where exactly the difference is ...


Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  Linux on zSeries Development
  [EMAIL PROTECTED]

Reply via email to