On x86_64-linux with -O2 -g gcc creates invalid DW_AT_upper_bound:
struct S
{
  int *a;
  int b;
  int **c;
  int d;
};

void foo (struct S *);
void bar (struct S *);

int
baz (void)
{
  struct S s;
  foo (&s);
  {
    int a[s.b];
    int *c[s.d];
    s.a = a;
    s.c = c;
    bar (&s);
  }
  return 0;
}
.long .LLST1 # DW_AT_upper_bound
.long .LLST3 # DW_AT_upper_bound
Note that loclistptr isn't valid for DW_AT_upper_bound attribute, unlike
DW_AT_location it can be a constant or reference, like DW_AT_location it can be
a block (exprloc) and unlike DW_AT_location it can't be loclistptr.

Discovered this by readelf -wo cc1 >/dev/null complaining about holes in
.debug_loc.


-- 
           Summary: [4.5 Regression] Wrong DW_AT_upper_bound
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: wrong-debug
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: jakub at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org


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

Reply via email to