On ppc32: /* { dg-options "-m32 -O2 -g" } */ extern int m; struct A { unsigned char a; }; struct B { void *b; }; extern struct B *fn (int x); struct C { struct C *c; }; static unsigned char *d; typedef int (*T) (struct C *, void *); struct C *foo (struct C *, T, void *); int fx (struct C *, void *);
static struct C * bar (struct C *x, unsigned char y, unsigned char z) { unsigned char v[2] = { y, z }; return foo (x, fx, v); } struct C * baz (struct A *x, long long int y) { struct B *b; struct C *c; long long int z; if (!(m == 4 || m == 2)) return 0; z = x->a; b = fn (z); if (!b) return 0; c = (struct C *) b->b; if (!c) return 0; if (m == 2 && z >= 240) z -= 240; else if (d) z = d[z]; if (z == 255) return 0; return bar (c->c, z, y); } emits: emits in one range for the y variable (DImode, i.e. 2 hard registers): .4byte .LVL0-.Ltext0 # Location list begin address (*.LLST2) .4byte .LVL2-.Ltext0 # Location list end address (*.LLST2) .2byte 0x6 # Location expression size .byte 0x55 # DW_OP_reg5 .byte 0x93 # DW_OP_piece .byte 0x4 # uleb128 0x4 .byte 0x56 # DW_OP_reg6 .byte 0x93 # DW_OP_piece .byte 0x4 # uleb128 0x4 .4byte .LVL2-.Ltext0 # Location list begin address (*.LLST2) .4byte .LVL3-.Ltext0 # Location list end address (*.LLST2) .2byte 0xb # Location expression size .byte 0x55 # DW_OP_reg5 .byte 0x93 # DW_OP_piece .byte 0x4 # uleb128 0x4 .byte 0x56 # DW_OP_reg6 .byte 0x93 # DW_OP_piece .byte 0x4 # uleb128 0x4 .byte 0x93 # DW_OP_piece .byte 0x8 # uleb128 0x8 .byte 0x56 # DW_OP_reg6 .byte 0x93 # DW_OP_piece .byte 0x4 # uleb128 0x4 ... Similar problems occur even on little-endian targets, although less often: 0xffffffff8014ebb0..0xffffffff8014ebc2 [ 0] fbreg 160 [ 3] piece 4 [ 5] fbreg 164 [ 8] piece 4 0xffffffff8014ebc2..0xffffffff8014ebc4 [ 0] fbreg 160 0xffffffff8014ebc4..0xffffffff8014ebd6 [ 0] fbreg 160 [ 3] piece 8 <-- BAD [ 5] fbreg 164 [ 8] piece 4 (64-bit variable). Not a regression, as -fvar-tracking is new in GCC 4.0, though one might say that before we at least were not generating invalid debug info. -- Summary: Invalid DWARF2 debug info emitted Product: gcc Version: 4.0.1 Status: UNCONFIRMED Severity: normal Priority: P2 Component: debug AssignedTo: jakub at gcc dot gnu dot org ReportedBy: jakub at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org GCC target triplet: ppc-linux, x86_64-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21946