Fix -feliminate-dwarf2-dups ICE.
authorDevang Patel <dpatel@apple.com>
Mon, 6 Oct 2003 22:25:19 +0000 (15:25 -0700)
committerDevang Patel <dpatel@gcc.gnu.org>
Mon, 6 Oct 2003 22:25:19 +0000 (15:25 -0700)
       gcc
       * dwarf2out.c (is_main_source): Remove variable.
       (dwarf2out_start_source_file): Do not check is_main_source.
       Do not reset is_main_source.
       (dwarf2out_init): Do not initialize is_main_source.

       testsuite
       * gcc.dg/debug/dwarf2-3.h: New test.
       * gcc.dg/debug/dwarf2-3.c: New test case for -feliminate-dwarf2-dups.

From-SVN: r72166

gcc/ChangeLog
gcc/dwarf2out.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/debug/dwarf2-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/debug/dwarf2-3.h [new file with mode: 0644]

index fd59fc86f708f3a8c9a33fcbd3c96f454fed9cd0..6a6dc5d35f17fa25c09165231d4d7e47195b5250 100644 (file)
@@ -1,3 +1,10 @@
+2003-10-06  Devang Patel  <dpatel@apple.com>
+
+       * dwarf2out.c (is_main_source): Remove variable.
+       (dwarf2out_start_source_file): Do not check is_main_source.
+       Do not reset is_main_source.
+       (dwarf2out_init): Do not initialize is_main_source.
+       
 2003-10-06  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
 
        * fixinc/inclhack.def (stdio_va_list): Removed _ap fix.
index 9a23c76b79eef71e7ab6b3b2fb3ee79028e2c348..2642e81ceaeb1b1325412d4352c2684c4dd87151 100644 (file)
@@ -3443,12 +3443,6 @@ static unsigned long next_die_offset;
 /* Record the root of the DIE's built for the current compilation unit.  */
 static GTY(()) dw_die_ref comp_unit_die;
 
-#ifdef DWARF2_DEBUGGING_INFO
-/* We need special handling in dwarf2out_start_source_file if it is
-   first one.  */
-static int is_main_source;
-#endif
-
 /* A list of DIEs with a NULL parent waiting to be relocated.  */
 static GTY(()) limbo_die_node *limbo_die_list;
 
@@ -12285,7 +12279,7 @@ dwarf2out_source_line (unsigned int line, const char *filename)
 static void
 dwarf2out_start_source_file (unsigned int lineno, const char *filename)
 {
-  if (flag_eliminate_dwarf2_dups && !is_main_source)
+  if (flag_eliminate_dwarf2_dups)
     {
       /* Record the beginning of the file for break_out_includes.  */
       dw_die_ref bincl_die;
@@ -12294,8 +12288,6 @@ dwarf2out_start_source_file (unsigned int lineno, const char *filename)
       add_AT_string (bincl_die, DW_AT_name, filename);
     }
 
-  is_main_source = 0;
-
   if (debug_info_level >= DINFO_LEVEL_VERBOSE)
     {
       named_section_flags (DEBUG_MACINFO_SECTION, SECTION_DEBUG);
@@ -12396,7 +12388,6 @@ dwarf2out_init (const char *filename ATTRIBUTE_UNUSED)
      invoked when the given (base) source file was compiled.  We will fill
      in this value in dwarf2out_finish.  */
   comp_unit_die = gen_compile_unit_die (NULL);
-  is_main_source = 1;
 
   VARRAY_TREE_INIT (incomplete_types, 64, "incomplete_types");
 
index 48761b7cb2cefb1794947abb63d69ead23a40177..6c87236fe2e238e7190186a53c8867e7cf6eb8ad 100644 (file)
@@ -1,3 +1,8 @@
+2003-10-06  Devang Patel  <dpatel@apple.com>
+
+       * gcc.dg/debug/dwarf2-3.h: New test.
+       * gcc.dg/debug/dwarf2-3.c: New test case for -feliminate-dwarf2-dups.
+       
 2003-10-06  Wolfgang Bangerth  <bangerth@ticam.utexas.edu>
 
        * g++.dg/opt/cfg2.C: New test.
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2-3.c b/gcc/testsuite/gcc.dg/debug/dwarf2-3.c
new file mode 100644 (file)
index 0000000..f0c129c
--- /dev/null
@@ -0,0 +1,13 @@
+/* Test -feliminate-dwarf2-dups */
+/* Contributed by Devang Patel <dpatel@apple.com> */
+/* { dg-do compile } */
+/* { dg-options "-feliminate-dwarf2-dups" } */
+
+#include "dwarf2-3.h"
+
+int main()
+{
+  struct point p;
+  p.x = 0;
+  p.y = 0;
+}
diff --git a/gcc/testsuite/gcc.dg/debug/dwarf2-3.h b/gcc/testsuite/gcc.dg/debug/dwarf2-3.h
new file mode 100644 (file)
index 0000000..26ad0ba
--- /dev/null
@@ -0,0 +1,9 @@
+/* Test -feliminate-dwarf2-dups */
+/* Contributed by Devang Patel <dpatel@apple.com> */
+
+struct point
+{
+  int x;
+  int y;
+};
+