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]

PATCH: Fix PR2975



This patch fixes PR2975, as discussed earlier.

Bootstrapped and tested on i686-pc-linux-gnu, installed on the
mainline and on the branch.

While looking at this stuff, I noticed that print_rtx was spewing
garbage.  The reason was that we used a shockingly primitive way of
doing indentation: we printed characters out of a fixed-length buffer
full of spaces.  Guess what happens when you decide to indent further
than there are characters in the buffer.  Unbelievable that such code
ever went in to the compiler.

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

2001-06-05  Mark Mitchell  <mark@codesourcery.com>

	* print-rtl.c (xspaces): Remove.
	(print_rtx): Use printf field-width, rather than xpsaces, to
	indent.
	* toplev.c (main): Disable sibling-call optimization if we are
	handling exceptions.
	
Index: print-rtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/print-rtl.c,v
retrieving revision 1.63.4.1
diff -c -p -r1.63.4.1 print-rtl.c
*** print-rtl.c	2001/03/02 19:51:55	1.63.4.1
--- print-rtl.c	2001/06/05 20:24:45
*************** const char * reg_names[] = REGISTER_NAME
*** 47,54 ****
  
  static FILE *outfile;
  
- static const char xspaces[] = "                                                                                                                                                                ";
- 
  static int sawclose = 0;
  
  static int indent;
--- 47,52 ----
*************** print_rtx (in_rtx)
*** 91,99 ****
        if (flag_simple)
  	fputc (' ', outfile);
        else
! 	fprintf (outfile, "\n%s%s",
! 		 print_rtx_head,
! 		 (xspaces + (sizeof xspaces - 1 - indent * 2)));
        sawclose = 0;
      }
  
--- 89,96 ----
        if (flag_simple)
  	fputc (' ', outfile);
        else
! 	fprintf (outfile, "\n%s%*s",
! 		 print_rtx_head, indent * 2, "");
        sawclose = 0;
      }
  
*************** print_rtx (in_rtx)
*** 282,290 ****
  	indent += 2;
  	if (sawclose)
  	  {
! 	    fprintf (outfile, "\n%s%s",
!                      print_rtx_head,
! 		     (xspaces + (sizeof xspaces - 1 - indent * 2)));
  	    sawclose = 0;
  	  }
  	fputs ("[ ", outfile);
--- 279,286 ----
  	indent += 2;
  	if (sawclose)
  	  {
! 	    fprintf (outfile, "\n%s%*s",
!                      print_rtx_head, indent * 2, "");
  	    sawclose = 0;
  	  }
  	fputs ("[ ", outfile);
*************** print_rtx (in_rtx)
*** 300,308 ****
  	    indent -= 2;
  	  }
  	if (sawclose)
! 	  fprintf (outfile, "\n%s%s",
!                    print_rtx_head,
! 		   (xspaces + (sizeof xspaces - 1 - indent * 2)));
  
  	fputs ("] ", outfile);
  	sawclose = 1;
--- 296,303 ----
  	    indent -= 2;
  	  }
  	if (sawclose)
! 	  fprintf (outfile, "\n%s%*s",
!                    print_rtx_head, indent * 2, "");
  
  	fputs ("] ", outfile);
  	sawclose = 1;
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.420.2.24
diff -c -p -r1.420.2.24 toplev.c
*** toplev.c	2001/05/27 16:07:26	1.420.2.24
--- toplev.c	2001/06/05 20:24:51
*************** main (argc, argv)
*** 4906,4911 ****
--- 4906,4917 ----
  	warning ("-Wuninitialized is not supported without -O");
      }
  
+   /* We do not currently support sibling-call optimization in the
+      presence of exceptions.  See PR2975 for a test-case that will
+      fail if we try to combine both of these features.  */
+   if (flag_exceptions)
+     flag_optimize_sibling_calls = 0;
+ 
  #ifdef OVERRIDE_OPTIONS
    /* Some machines may reject certain combinations of options.  */
    OVERRIDE_OPTIONS;


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