http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53118
Bug #: 53118 Summary: [4.5/4.6/4.7 regression] -feliminate-dwarf2-dups is broken for C++ Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Keywords: wrong-debug Severity: normal Priority: P3 Component: debug AssignedTo: unassig...@gcc.gnu.org ReportedBy: ja...@gcc.gnu.org As noted in http://gcc.gnu.org/ml/gcc-help/2010-09/msg00081.html , -feliminate-dwarf2-dups has been broken for C++ ever since GCC 4.0; the front end now tokenizes the entire input before doing any parsing, so the calls to dwarf2out_{start,end}_source_file are all clustered at the beginning rather than properly wrapping the contents of headers. Testcase from that message: ------ source file bar.c: -------- #include "foo.h" #include "bar.h" struct Foo myfoo; struct Bar mybar; ---------------------------------- ------ header file foo.h: -------- struct Foo { double d_foo; int i_foo; }; ---------------------------------- ------ header file bar.h: -------- struct Bar { double d_bar; int i_bar; char c_bar; }; ----------------------------------