[Bug debug/53023] file_table_last_lookup is used, but never set

hjl.tools at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Apr 17 20:21:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53023

--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> 2012-04-17 20:19:34 UTC ---
This patch sets file_table_last_lookup:

diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 7e2ce58..d5783c2 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -20043,13 +20043,15 @@ lookup_filename (const char *file_name)
   /* Didn't match the previous lookup, search the table.  */
   slot = htab_find_slot_with_hash (file_table, file_name,
                    htab_hash_string (file_name), INSERT);
-  if (*slot)
-    return (struct dwarf_file_data *) *slot;
-
-  created = ggc_alloc_dwarf_file_data ();
-  created->filename = file_name;
-  created->emitted_number = 0;
-  *slot = created;
+  created = (struct dwarf_file_data *) *slot;
+  if (!created)
+    {
+      created = ggc_alloc_dwarf_file_data ();
+      created->filename = file_name;
+      created->emitted_number = 0;
+      *slot = created;
+    }
+  file_table_last_lookup = created;
   return created;
 }



More information about the Gcc-bugs mailing list