This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch][commit] Fix gdb.cp/cpcompletion.exp failure with GCC-4.4.0
- From: ppluzhnikov at google dot com (Paul Pluzhnikov)
- To: gdb-patches at sourceware dot org
- Date: Mon, 9 Feb 2009 16:59:34 -0800 (PST)
- Subject: [patch][commit] Fix gdb.cp/cpcompletion.exp failure with GCC-4.4.0
Greetings,
gdb.cp/cpcompletion.exp fails under GCC-4.4.0, because compiler
optimizes out the 'a' variable:
<1><50d>: Abbrev Number: 32 (DW_TAG_subprogram)
<50e> DW_AT_external : 1
<50f> DW_AT_name : (indirect string, offset: 0xcd): main
<513> DW_AT_decl_file : 1
<514> DW_AT_decl_line : 42
<515> DW_AT_type : <33c>
<519> DW_AT_low_pc : 0x400370
<521> DW_AT_high_pc : 0x4003b0
<529> DW_AT_frame_base : 0xfc (location list)
<52d> DW_AT_sibling : <569>
<2><531>: Abbrev Number: 33 (DW_TAG_structure_type)
<532> DW_AT_name : (indirect string, offset: 0x246): <anonymous struct>
<536> DW_AT_byte_size : 1
<537> DW_AT_decl_file : 1
<538> DW_AT_decl_line : 45
<539> DW_AT_sibling : <551>
<3><53d>: Abbrev Number: 34 (DW_TAG_subprogram)
<53e> DW_AT_name : get
<542> DW_AT_decl_file : 1
<543> DW_AT_decl_line : 46
<544> DW_AT_type : <33c>
<548> DW_AT_declaration : 1
<4><549>: Abbrev Number: 6 (DW_TAG_formal_parameter)
<54a> DW_AT_type : <569>
<54e> DW_AT_artificial : 1
<2><551>: Abbrev Number: 35 (DW_TAG_variable)
<552> DW_AT_name : a
<554> DW_AT_decl_file : 1
<555> DW_AT_decl_line : 47
<556> DW_AT_type : <531>
<<<< Missing DW_AT_location
<2><55a>: Abbrev Number: 36 (DW_TAG_variable)
<55b> DW_AT_name : (indirect string, offset: 0xb7): foo1
Committed as obvious.
--
Paul Pluzhnikov
testsuite/ChangeLog:
2009-02-06 Paul Pluzhnikov <ppluzhnikov@google.com>
* gdb.cp/pr9594.cc: Prevent GCC from optimizing 'a' out.
Index: gdb.cp/pr9594.cc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/pr9594.cc,v
retrieving revision 1.1
diff -u -p -u -r1.1 pr9594.cc
--- gdb.cp/pr9594.cc 3 Feb 2009 01:09:01 -0000 1.1
+++ gdb.cp/pr9594.cc 10 Feb 2009 00:56:59 -0000
@@ -47,5 +47,6 @@ int main ()
} a;
Foo foo1;
foo1.set_foo (42); // Set breakpoint here.
+ a.get(); // Prevent compiler from throwing 'a' away.
return 0;
}