aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2015-09-21 14:02:27 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2015-09-21 14:02:27 +0000
commit9386cdeee67582bdef3590ec0f9a8b1ab7600e59 (patch)
tree3060190ad1b1018a00a514adf4aab582c10767f7 /gcc
parentce89c02e8661d0461aa8e21e2159ecb67dfe1145 (diff)
downloadgcc-9386cdeee67582bdef3590ec0f9a8b1ab7600e59.zip
gcc-9386cdeee67582bdef3590ec0f9a8b1ab7600e59.tar.gz
gcc-9386cdeee67582bdef3590ec0f9a8b1ab7600e59.tar.bz2
re PR debug/67664 (Duplicate AT_const_value attributes in some c++ cases.)
2015-09-21 Richard Biener <rguenther@suse.de> PR debug/67664 * dwarf2out.c (add_location_or_const_value_attribute): Remove attribute parameter. Early exit if either DW_AT_const_value or DW_AT_location are present already. (gen_variable_die): Adjust caller. (dwarf2out_late_global_decl): Likewise. * g++.dg/debug/dwarf2/pr67764.C: New testcase. From-SVN: r227972
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/dwarf2out.c18
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/debug/dwarf2/pr67764.C17
4 files changed, 39 insertions, 10 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bf68896..d275898 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2015-09-21 Richard Biener <rguenther@suse.de>
+
+ PR debug/67664
+ * dwarf2out.c (add_location_or_const_value_attribute): Remove
+ attribute parameter. Early exit if either DW_AT_const_value
+ or DW_AT_location are present already.
+ (gen_variable_die): Adjust caller.
+ (dwarf2out_late_global_decl): Likewise.
+
2015-09-21 Oleg Endo <olegendo@gcc.gnu.org>
PR target/67657
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 9ef2a8a..598ba53 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -3253,8 +3253,7 @@ static void insert_int (HOST_WIDE_INT, unsigned, unsigned char *);
static void insert_wide_int (const wide_int &, unsigned char *, int);
static void insert_float (const_rtx, unsigned char *);
static rtx rtl_for_decl_location (tree);
-static bool add_location_or_const_value_attribute (dw_die_ref, tree, bool,
- enum dwarf_attribute);
+static bool add_location_or_const_value_attribute (dw_die_ref, tree, bool);
static bool tree_add_const_value_attribute (dw_die_ref, tree);
static bool tree_add_const_value_attribute_for_decl (dw_die_ref, tree);
static void add_name_attribute (dw_die_ref, const char *);
@@ -16136,8 +16135,7 @@ fortran_common (tree decl, HOST_WIDE_INT *value)
since we will need to refer to them each time the function is inlined. */
static bool
-add_location_or_const_value_attribute (dw_die_ref die, tree decl, bool cache_p,
- enum dwarf_attribute attr)
+add_location_or_const_value_attribute (dw_die_ref die, tree decl, bool cache_p)
{
rtx rtl;
dw_loc_list_ref list;
@@ -16150,7 +16148,8 @@ add_location_or_const_value_attribute (dw_die_ref die, tree decl, bool cache_p,
if (TREE_CODE (decl) == ERROR_MARK)
return false;
- if (get_AT (die, attr))
+ if (get_AT (die, DW_AT_location)
+ || get_AT (die, DW_AT_const_value))
return true;
gcc_assert (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == PARM_DECL
@@ -16216,7 +16215,7 @@ add_location_or_const_value_attribute (dw_die_ref die, tree decl, bool cache_p,
}
if (list)
{
- add_AT_location_description (die, attr, list);
+ add_AT_location_description (die, DW_AT_location, list);
return true;
}
/* None of that worked, so it must not really have a location;
@@ -18116,7 +18115,7 @@ gen_formal_parameter_die (tree node, tree origin, bool emit_name_p,
equate_decl_number_to_die (node, parm_die);
if (! DECL_ABSTRACT_P (node_or_origin))
add_location_or_const_value_attribute (parm_die, node_or_origin,
- node == NULL, DW_AT_location);
+ node == NULL);
break;
@@ -19662,7 +19661,7 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
add_pubname (decl_or_origin, var_die);
else
add_location_or_const_value_attribute (var_die, decl_or_origin,
- decl == NULL, DW_AT_location);
+ decl == NULL);
}
else
tree_add_const_value_attribute_for_decl (var_die, decl_or_origin);
@@ -21639,8 +21638,7 @@ dwarf2out_late_global_decl (tree decl)
{
dw_die_ref die = lookup_decl_die (decl);
if (die)
- add_location_or_const_value_attribute (die, decl, false,
- DW_AT_location);
+ add_location_or_const_value_attribute (die, decl, false);
}
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6bac5cc..43c2260 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-09-21 Richard Biener <rguenther@suse.de>
+
+ PR debug/67664
+ * g++.dg/debug/dwarf2/pr67764.C: New testcase.
+
2015-09-21 Oleg Endo <olegendo@gcc.gnu.org>
PR target/64345
diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pr67764.C b/gcc/testsuite/g++.dg/debug/dwarf2/pr67764.C
new file mode 100644
index 0000000..f32ec3c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/debug/dwarf2/pr67764.C
@@ -0,0 +1,17 @@
+// PR debug/67664
+// { dg-do compile }
+// { dg-options "-gdwarf-2 -dA" }
+
+struct T
+{
+ static const int a = 0;
+};
+
+int main()
+{
+ T t;
+ return t.a;
+}
+
+// Once for the value and once for the abbrev
+// { dg-final { scan-assembler-times "DW_AT_const_value" 2 } }