* dwarf2out.c (tree_add_const_value_attribute_for_decl): Don't add
DW_AT_const_value if VAR_DIE already has DW_AT_abstract_origin
refering to a DIE with DW_AT_const_value.
* gcc.dg/debug/dwarf2/inline3.c: New test.
From-SVN: r152535
+2009-10-07 Jakub Jelinek <jakub@redhat.com>
+
+ * dwarf2out.c (tree_add_const_value_attribute_for_decl): Don't add
+ DW_AT_const_value if VAR_DIE already has DW_AT_abstract_origin
+ refering to a DIE with DW_AT_const_value.
+
2009-10-07 Vladimir Makarov <vmakarov@redhat.com>
PR middle-end/22072
else
return false;
+ /* Don't add DW_AT_const_value if abstract origin already has one. */
+ if (get_AT (var_die, DW_AT_const_value))
+ return false;
+
return tree_add_const_value_attribute (var_die, DECL_INITIAL (decl));
}
+2009-10-07 Jakub Jelinek <jakub@redhat.com>
+
+ * gcc.dg/debug/dwarf2/inline3.c: New test.
+
2009-10-07 Daniel Kraft <d@domob.eu>
PR fortran/41615
--- /dev/null
+/* Verify that only one DW_AT_const_value is emitted for baz,
+ not for baz abstract DIE and again inside of
+ DW_TAG_inlined_subroutine. */
+/* { dg-options "-O2 -g -dA" } */
+/* { dg-do compile } */
+/* { dg-final { scan-assembler-times " DW_AT_const_value" 1 } } */
+
+struct A { const long i; const long j; };
+
+static inline long
+foo (void)
+{
+ const struct A baz = { .i = 2, .j = 21 };
+ asm volatile ("" : : : "memory");
+ return baz.i * baz.j;
+}
+
+int
+main ()
+{
+ return foo () - 42;
+}