struct a { int i; int j; }; static void g (int j) { } static struct a f() { struct a a; a.i = 42; g (a.i); /* line 13 */ return a; } int main () { f(); return 0; } ------------------------------------------------------------------------------ <2><8a>: Abbrev Number: 8 (DW_TAG_variable) <8b> DW_AT_name : a <93> DW_AT_location : 2 byte block: 73 0 (DW_OP_breg3: 0) <2><96>: Abbrev Number: 9 (DW_TAG_lexical_block) <97> DW_AT_low_pc : 0x80483d3 <9b> DW_AT_high_pc : 0x80483e3 <3><9f>: Abbrev Number: 8 (DW_TAG_variable) <a0> DW_AT_name : a <a8> DW_AT_location : 2 byte block: 91 6c (DW_OP_fbreg: -20) - but `a' is never located in the frame. ------------------------------------------------------------------------------ g++ -m32 -o a a.C -Wall -g gdb -nx -ex 'b 13' -ex r -ex 'p/x $pc' -ex 'p a.i' ./a Actual: $2 = 5823984 Expected: $2 = 42 ------------------------------------------------------------------------------ FAIL: g++ (GCC) 4.6.0 20100601 (experimental) g++ (GCC) 4.5.1 20100601 (prerelease) g++ (GCC) 4.4.5 20100601 (prerelease)
It affects also x86_64 when it cannot return the whole class in registers. Failed to reproduce it with plain C. -- Summary: -O0 -g wrong DW_AT_location on c++ class retval Product: gcc Version: 4.4.5 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jan dot kratochvil at redhat dot com GCC target triplet: i386-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44367