dwarf2out (output_file_names): Don't crash if called with empty file_table.
authorUlrich Weigand <uweigand@de.ibm.com>
Tue, 21 Jan 2003 23:10:07 +0000 (23:10 +0000)
committerUlrich Weigand <uweigand@gcc.gnu.org>
Tue, 21 Jan 2003 23:10:07 +0000 (23:10 +0000)
* dwarf2out (output_file_names): Don't crash if called
with empty file_table.

From-SVN: r61576

gcc/ChangeLog
gcc/dwarf2out.c

index de4c8f12d0e7131ad5dc19febff1123b18c6b631..0ff1f44561619cd758cf0e4fbb9710a02422a4d3 100644 (file)
@@ -1,3 +1,8 @@
+2003-01-21  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * dwarf2out (output_file_names): Don't crash if called
+       with empty file_table.
+
 2003-01-21  Zack Weinberg  <zack@codesourcery.com>
 
        * genautomata.c (output_internal_insn_latency_func): Add
index 12e6fde24e3db6ef778a192f36ed7ab5193e5ef3..4502a299b913833b7e6524ee5cc11283614b6bbd 100644 (file)
@@ -7289,6 +7289,14 @@ output_file_names ()
   size_t i;
   int idx;
 
+  /* Handle the case where file_table is empty.  */
+  if (VARRAY_ACTIVE_SIZE (file_table) <= 1)
+    {
+      dw2_asm_output_data (1, 0, "End directory table");
+      dw2_asm_output_data (1, 0, "End file name table");
+      return;
+    }
+
   /* Allocate the various arrays we need.  */
   files = (struct file_info *) alloca (VARRAY_ACTIVE_SIZE (file_table)
                                       * sizeof (struct file_info));