This is the mail archive of the
gcc-cvs@gcc.gnu.org
mailing list for the GCC project.
r190263 - in /branches/google/gcc-4_7/gcc: Chan...
- From: ccoutant at gcc dot gnu dot org
- To: gcc-cvs at gcc dot gnu dot org
- Date: Thu, 09 Aug 2012 18:59:13 -0000
- Subject: r190263 - in /branches/google/gcc-4_7/gcc: Chan...
Author: ccoutant
Date: Thu Aug 9 18:59:12 2012
New Revision: 190263
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190263
Log:
This patch is for the google/gcc-4_7 branch. It's a backport of a
pending upstream patch at:
http://gcc.gnu.org/ml/gcc-patches/2012-08/msg00398.html
Google ref b/6705530.
Original description:
With --std=c++11, a template parameter can refer to a local type defined
within a function. Because that local type doesn't qualify for its own
type unit, we copy it as an "unworthy" type into the type unit that refers
to it, but we copy too much, leading to a comdat type unit that contains a
DIE with subprogram definitions rather than declarations. These DIEs may
have DW_AT_low_pc/high_pc or DW_AT_ranges attributes, and consequently can
refer to range list entries that don't get emitted because they're not
marked when the compile unit is scanned, eventually causing an undefined
symbol at link time.
In addition, while debugging this problem, I found that the
DW_AT_object_pointer attribute, when left in the skeletons that are left
behind in the compile unit, causes duplicate copies of the types to be
copied back into the compile unit.
This patch fixes these problems by removing the DW_AT_object_pointer
attribute from the skeleton left behind in the compile unit, and by
copying DW_TAG_subprogram DIEs as declarations when copying "unworthy"
types into a type unit. In order to preserve information in the DIE
structure, I also added DW_AT_abstract_origin as an attribute that
should be copied when cloning a DIE as a declaration.
I also fixed the dwarf4-typedef.C test, which should be turning on
the -fdebug-types-section flag.
2012-08-09 Cary Coutant <ccoutant@google.com>
gcc/
* dwarf2out.c (clone_as_declaration): Copy DW_AT_abstract_origin
attribute.
(generate_skeleton_bottom_up): Remove DW_AT_object_pointer attribute
from original DIE.
(clone_tree_hash): Rename to ...
(clone_tree_partial): ... this; change callers. Copy
DW_TAG_subprogram DIEs as declarations.
gcc/testsuite/
* g++.dg/debug/dwarf2/dwarf4-nested.C: New test case.
* g++.dg/debug/dwarf2/dwarf4-typedef.C: Add
-fdebug-types-section flag.
Added:
branches/google/gcc-4_7/gcc/testsuite/g++.dg/debug/dwarf2/dwarf4-nested.C
Modified:
branches/google/gcc-4_7/gcc/ChangeLog.google-4_7
branches/google/gcc-4_7/gcc/dwarf2out.c
branches/google/gcc-4_7/gcc/testsuite/ChangeLog.google-4_7
branches/google/gcc-4_7/gcc/testsuite/g++.dg/debug/dwarf2/dwarf4-typedef.C