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 PR6706


PR 6706 is a regression on the use of -gdwarf pertaining to
variable-sized arrays.

Fixed with the attached patch.  Tested on i686-pc-linux-gnu, applied
on the mainline and on the branch.

-- 
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

2002-07-03  Mark Mitchell  <mark@codesourcery.com>

	PR c++/6706
	* dwarfout.c (output_reg_number): Fix warning message.
	(output_bound_representation): Check SAVE_EXPR_RTL is not NULL
	before using it.
	
2002-07-03  Mark Mitchell  <mark@codesourcery.com>

	PR c++/6706
	* g++.dg/debug/debug6.C: New test.
	* g++.dg/debug/debug7.C: New test.

Index: dwarfout.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarfout.c,v
retrieving revision 1.106
diff -c -p -r1.106 dwarfout.c
*** dwarfout.c	22 Jan 2002 21:58:41 -0000	1.106
--- dwarfout.c	5 Jul 2002 16:17:36 -0000
*************** output_reg_number (rtl)
*** 2086,2092 ****
  
    if (regno >= DWARF_FRAME_REGISTERS)
      {
!       warning_with_decl (dwarf_last_decl, "internal regno botch: regno = %d\n",
  			 regno);
        regno = 0;
      }
--- 2086,2093 ----
  
    if (regno >= DWARF_FRAME_REGISTERS)
      {
!       warning_with_decl (dwarf_last_decl, 
! 			 "internal regno botch: `%s' has regno = %d\n",
  			 regno);
        regno = 0;
      }
*************** output_bound_representation (bound, dim_
*** 2303,2309 ****
  		   || TREE_CODE (bound) == CONVERT_EXPR)
  	      bound = TREE_OPERAND (bound, 0);
  
! 	    if (TREE_CODE (bound) == SAVE_EXPR)
  	      output_loc_descriptor
  		(eliminate_regs (SAVE_EXPR_RTL (bound), 0, NULL_RTX));
  	  }
--- 2304,2311 ----
  		   || TREE_CODE (bound) == CONVERT_EXPR)
  	      bound = TREE_OPERAND (bound, 0);
  
! 	    if (TREE_CODE (bound) == SAVE_EXPR 
! 		&& SAVE_EXPR_RTL (bound))
  	      output_loc_descriptor
  		(eliminate_regs (SAVE_EXPR_RTL (bound), 0, NULL_RTX));
  	  }
Index: testsuite/g++.dg/debug/debug6.C
===================================================================
RCS file: testsuite/g++.dg/debug/debug6.C
diff -N testsuite/g++.dg/debug/debug6.C
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/debug/debug6.C	5 Jul 2002 16:17:39 -0000
***************
*** 0 ****
--- 1,7 ----
+ // { dg-do compile }
+ 
+ void foo()
+ {
+   int i=1, x[i];
+ }
+ 
Index: testsuite/g++.dg/debug/debug7.C
===================================================================
RCS file: testsuite/g++.dg/debug/debug7.C
diff -N testsuite/g++.dg/debug/debug7.C
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/debug/debug7.C	5 Jul 2002 16:17:39 -0000
***************
*** 0 ****
--- 1,18 ----
+ // { dg-do compile }
+ 
+ void f (int);
+ 
+ int
+ main() {
+ 
+   int a = 4;
+   int b = 5;
+   int (*x)[b] = new int[a][b];
+ 
+   x[2][1] = 7;
+ 
+   for (int i = 0; i < a; ++i)
+     for (int j = 0; j < b; ++j)
+       f (x[i][j]);
+   delete [] x;
+ }


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