This is the mail archive of the gcc-bugs@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]

[Bug debug/13956] New: [3.4/3.5 regression] incorrect stabs for nested local variables


Here is an excerpt from a test program:

  void f1 ()
  {
    int alpha;
    int beta;

    ...
    {
      int alpha;
      int gamma;
      ...
    }
    ...
   }

My command line is "gcc -gstabs+ -S alpha.c".

With gcc 3.3.2, I get these healthy-looking stabs:

  .LBE2:
        .size   f1, .-f1
        .stabs  "alpha:(0,1)",128,0,15,-4
        .stabs  "beta:(0,1)",128,0,16,-8
        .stabn  192,0,0,.LBB2-f1
        .stabs  "alpha:(0,1)",128,0,21,-12
        .stabs  "gamma:(0,1)",128,0,22,-16
        .stabn  192,0,0,.LBB3-f1
        .stabn  224,0,0,.LBE3-f1
        .stabn  224,0,0,.LBE2-f1

stabn 192 is N_LBRAC, and stabn 224 is N_RBRAC.  Each group of local variables
is followed by its range.  All is well.

With gcc HEAD 2003-04-11 03:00:00 UTC, all is still fine:

  .LBE2:
        .size   f1, .-f1
        .stabs  "alpha:(0,1)",128,0,15,-4
        .stabs  "beta:(0,1)",128,0,16,-8
        .stabn  192,0,0,.LBB2-f1
        .stabs  "alpha:(0,1)",128,0,21,-12
        .stabs  "gamma:(0,1)",128,0,22,-16
        .stabn  192,0,0,.LBB3-f1
        .stabn  224,0,0,.LBE3-f1
        .stabn  224,0,0,.LBE2-f1

With gcc HEAD 2003-04-11 04:30:00 UTC, the stabs are wrong:

        .size   f1, .-f1
        .stabs  "alpha:(0,1)",128,0,15,-4
        .stabs  "beta:(0,1)",128,0,16,-8
        .stabs  "alpha:(0,1)",128,0,21,-12
        .stabs  "gamma:(0,1)",128,0,22,-16
        .stabn  192,0,0,.LBB2-f1
        .stabn  224,0,0,.LBE2-f1

One of the N_LBRAC/N_RBRAC pairs has disappeared.

And with current gcc, gcc HEAD 2004-02-01 01:34:15 UTC:

        .size   f1, .-f1
        .stabs  "alpha:(0,1)",128,0,15,-4
        .stabs  "beta:(0,1)",128,0,16,-8
        .stabs  "alpha:(0,1)",128,0,21,-12
        .stabs  "gamma:(0,1)",128,0,22,-16
        .stabn  192,0,0,.LBB2-f1
        .stabn  224,0,0,.LBE2-f1

This problem came in with this patch:

  2003-04-10  Zack Weinberg  <zack@codesourcery.com>

        * c-decl.c (struct binding_level): Add shadowed_tags and
        function_body; remove this_block, tag_transparent, and
        subblocks_tag_transparent; update comments.
        ...

  2003-04-10  Zack Weinberg  <zack@codesourcery.com>

        * c-tree.h (struct lang_identifier): Replace global_value,
        local_value members with symbol_value, tag_value.  Kill
        implicit_decl and limbo_value.
        ...

There are two ChangeLog entries here, but only one patch.

This is the same patch that caused PR debug/12267.  Per the comments in 12267,
I'm assigning it to Zack (or trying to).

Attachments to follow.

-- 
           Summary: [3.4/3.5 regression] incorrect stabs for nested local
                    variables
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P1
         Component: debug
        AssignedTo: zack at gcc dot gnu dot org
        ReportedBy: mec dot gnu at mindspring dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13956


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