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]

Dwarf2 and nested function


I've found the problem in 20001002 snapshot for sh-unknown-linux-gnu.

CC1 aborts in dwarf2out.c:gen_subprogram_die, because of the nested
function.  The argument is: -musermode -ml -m3 -O -freorder-blocks -g
# For -g, GNU/Linux on SuperH uses DWARF2.

It seems that the reorder_blocks trigger the problem.

Here is the test case (originally found in print_fp.c of glibc-2.1.96):
--------------------------
int
__printf_fp (int dbl)
{
  int hack_digit (void) { return 0; }
  const char *special;
  int is_neg = 0;

  special = "INF";
  is_neg = (dbl < 0);

  if (special)
    if (is_neg)
      return 0;

  return 1;
}
--------------------------

Here's a workaround, just for me.

2000-10-30  NIIBE Yutaka  <gniibe@m17n.org>

	* dwarf2out.c (gen_subprogram_die): Handle the case of nested
	function.

Index: gcc/dwarf2out.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/dwarf2out.c,v
retrieving revision 1.212
diff -c -3 -p -r1.212 dwarf2out.c
*** dwarf2out.c	2000/10/20 17:35:18	1.212
--- dwarf2out.c	2000/10/30 09:23:33
*************** gen_subprogram_die (decl, context_die)
*** 9145,9151 ****
  	     we should detect this case and ignore it.  For now, if we have
  	     already reported an error, any error at all, then assume that
  	     we got here because of a input error, not a dwarf2 bug.  */
! 	  if (errorcount)
  	    return;
  	  abort ();
  	}
--- 9145,9152 ----
  	     we should detect this case and ignore it.  For now, if we have
  	     already reported an error, any error at all, then assume that
  	     we got here because of a input error, not a dwarf2 bug.  */
! 	  if (errorcount
! 	      || (TREE_CODE (decl) == FUNCTION_DECL && decl_function_context (decl)))
  	    return;
  	  abort ();
  	}
-- 

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