This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[ast-optimizer-branch] Dealing with programs with syntax errors [patch]
- To: gcc-patches at gcc dot gnu dot org
- Subject: [ast-optimizer-branch] Dealing with programs with syntax errors [patch]
- From: Diego Novillo <dnovillo at redhat dot com>
- Date: Mon, 1 Oct 2001 10:43:10 -0400
- Organization: Red Hat Canada
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 ();