[3.1] don't optimize with errors

Richard Henderson rth@redhat.com
Wed Mar 27 10:53:00 GMT 2002


There was some sparc ice failure (sorry I've misplaced the name of
the existing test case) that can be avoided by not continuing.

And, frankly, this has the potential to raise the signal-to-noise
ratio in future bug reports, since we won't be bothered by (some)
silly ice-on-illegal reports.



r~



        * toplev.c (rest_of_compilation): Don't compile if we've had errors.

        * g++.old-deja/g++.brendan/crash52.C: Remove return warning marker.
        * g++.old-deja/g++.jason/report.C: Likewise.

Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.574.2.5
diff -c -p -d -u -r1.574.2.5 toplev.c
--- toplev.c	2002/03/26 22:39:28	1.574.2.5
+++ toplev.c	2002/03/27 18:46:24
@@ -2541,8 +2541,11 @@ rest_of_compilation (decl)
   rtx_equal_function_value_matters = 0;
   purge_hard_subreg_sets (get_insns ());
 
-  /* Don't return yet if -Wreturn-type; we need to do cleanup_cfg.  */
-  if ((rtl_dump_and_exit || flag_syntax_only) && !warn_return_type)
+  /* Early return if there were errors.  We can run afoul of our
+     consistency checks, and there's not really much point in fixing them.
+     Don't return yet if -Wreturn-type; we need to do cleanup_cfg.  */
+  if (((rtl_dump_and_exit || flag_syntax_only) && !warn_return_type)
+      || errorcount || sorrycount)
     goto exit_rest_of_compilation;
 
   /* We may have potential sibling or tail recursion sites.  Select one
Index: testsuite/g++.old-deja/g++.brendan/crash52.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.old-deja/g++.brendan/crash52.C,v
retrieving revision 1.4
diff -c -p -d -u -r1.4 crash52.C
--- crash52.C	2001/04/06 22:05:06	1.4
+++ crash52.C	2002/03/27 18:46:24
@@ -10,5 +10,4 @@ public:
 
 A &f(A &a) {// ERROR -  new decl.*
   std::cout << "Blah\n";
-} // ERROR - non-void function
-
+}
Index: testsuite/g++.old-deja/g++.jason/report.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.old-deja/g++.jason/report.C,v
retrieving revision 1.7
diff -c -p -d -u -r1.7 report.C
--- report.C	2002/02/22 11:57:49	1.7
+++ report.C	2002/03/27 18:46:24
@@ -55,7 +55,7 @@ bar2 baz (X::Y y)
   bar2 wa [5];
   wa[0] = baz(f);
   undef2 (1); // ERROR - implicit declaration
-} // ERROR - non-void
+}
 
 int ninny ()
 {
@@ -70,4 +70,4 @@ int ninny ()
 int darg (char X::*p)
 {
    undef3 (1); // ERROR - implicit declaration
-} // ERROR - non-void
+}



More information about the Gcc-patches mailing list