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]

[ast-optimizer-branch] Dealing with programs with syntax errors [patch]


Graham Stott found this while building programs with syntax
errors.

Bootstrapped and regression tested on x86.  Committed to the AST
branch.

Diego.


	* tree-optimize.c (optimize_tree): Early return if the program has
	errors.

Index: tree-optimize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-optimize.c,v
retrieving revision 1.1.2.4
diff -d -p -d -u -p -r1.1.2.4 tree-optimize.c
--- tree-optimize.c	2001/10/01 02:59:47	1.1.2.4
+++ tree-optimize.c	2001/10/01 13:08:20
@@ -42,12 +42,16 @@ void
 optimize_tree (t)
      tree t;
 {
+  /* Don't bother doing anything if the program has errors.  */
+  if (errorcount || sorrycount)
+    return;
+
   /* Flush out existing data.  */
   VARRAY_TREE_INIT (referenced_symbols, 20, "referenced_symbols");
 
   tree_find_basic_blocks (t);
 
-  if (n_basic_blocks > 0)
+  if (n_basic_blocks > 0 && ! (errorcount || sorrycount))
     {
       tree_find_varrefs ();
       tree_build_ssa ();


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