This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix -feliminate-dwarf2-dups ICE


We do not use debug hooks, to start new source file, for main input file anymore. So ignoring first source file is wrong. Without this patch we get ICE.

2003-09-26 Devang Patel <dpatel@gcc.gnu.org>

       * 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-09-26 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.


OK for mainline?
--
Devang


Index: dwarf2out.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/dwarf2out.c,v
retrieving revision 1.453
diff -c -3 -p -r1.453 dwarf2out.c
*** dwarf2out.c 23 Sep 2003 19:46:56 -0000 1.453
--- dwarf2out.c 26 Sep 2003 22:54:13 -0000
*************** static unsigned long next_die_offset;
*** 3417,3428 ****
/* 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;

--- 3417,3422 ----
*************** dwarf2out_source_line (unsigned int line
*** 12276,12282 ****
static void
dwarf2out_start_source_file (unsigned int lineno, const char *filename)
{
! if (flag_eliminate_dwarf2_dups && !is_main_source)
{
/* Record the beginning of the file for break_out_includes. */
dw_die_ref bincl_die;
--- 12270,12276 ----
static void
dwarf2out_start_source_file (unsigned int lineno, const char *filename)
{
! if (flag_eliminate_dwarf2_dups)
{
/* Record the beginning of the file for break_out_includes. */
dw_die_ref bincl_die;
*************** dwarf2out_start_source_file (unsigned in
*** 12285,12292 ****
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);
--- 12279,12284 ----
*************** dwarf2out_init (const char *filename ATT
*** 12387,12393 ****
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");

--- 12379,12384 ----
$ cat testsuite/gcc.dg/debug/dwarf2-3.h
/* Test -feliminate-dwarf2-dups */
/* Contributed by Devang Patel dpatel@apple.com */

struct point
{
  int x;
  int y;
};

$ cat testsuite/gcc.dg/debug/dwarf2-3.c
/* 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;
  return 0;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]