summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/dwarf2out.c15
2 files changed, 13 insertions, 9 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c06016ce7aa..76f53f4bd01 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
2012-11-08 Jakub Jelinek <jakub@redhat.com>
+ PR debug/53145
+ * dwarf2out.c (gen_compile_unit_die): Don't call gen_producer_string
+ here, instead add "" if producer_string is NULL.
+ (dwarf2out_finish): Call gen_producer_string here, unconditionally
+ decrease refcount of the old indirect string and set val_str to
+ find_AT_string result.
+
PR debug/54499
* cgraphunit.c (assemble_thunk): Don't call source_line debug hook
here, instead call insn_locations_{init,finalize} and initialize
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 7dd1f24b767..d55123b08f1 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -18867,9 +18867,7 @@ gen_compile_unit_die (const char *filename)
add_comp_dir_attribute (die);
}
- if (producer_string == NULL)
- producer_string = gen_producer_string ();
- add_AT_string (die, DW_AT_producer, producer_string);
+ add_AT_string (die, DW_AT_producer, producer_string ? producer_string : "");
/* If our producer is LTO try to figure out a common language to use
from the global list of translation units. */
@@ -23217,13 +23215,12 @@ dwarf2out_finish (const char *filename)
dw_die_ref main_comp_unit_die;
/* PCH might result in DW_AT_producer string being restored from the
- header compilation, fix it up if needed. */
+ header compilation, so always fill it with empty string initially
+ and overwrite only here. */
dw_attr_ref producer = get_AT (comp_unit_die (), DW_AT_producer);
- if (strcmp (AT_string (producer), producer_string) != 0)
- {
- struct indirect_string_node *node = find_AT_string (producer_string);
- producer->dw_attr_val.v.val_str = node;
- }
+ producer_string = gen_producer_string ();
+ producer->dw_attr_val.v.val_str->refcount--;
+ producer->dw_attr_val.v.val_str = find_AT_string (producer_string);
gen_scheduled_generic_parms_dies ();
gen_remaining_tmpl_value_param_die_attribute ();
OpenPOWER on IntegriCloud