[fortran,committed] Fix error caused by running front-end optimizatins after error
diff mbox series

Message ID 54e91b2c-16ce-f749-0d54-36e0ecb89d57@tkoenig.net
State New
Headers show
Series
  • [fortran,committed] Fix error caused by running front-end optimizatins after error
Related show

Commit Message

Thomas K├Ânig March 27, 2018, 6:48 p.m. UTC
Hello world,

I have just committed r258900 as obvious on trunk to fix an
out-of-memory error in front-end optimization, which was
caused by gfortran's AST being in an inconsistent state.

I suspect that this will also fix other, as yet unknown
errors.

I will backport to the other affected branches, gcc-7 and gcc-6,
over the next few days.

Regards

	Thomas

2018-03-27  Thomas Koenig  <tkoenig@gcc.gnu.org>

         PR fortran/85084
         * frontend-passes.c (gfc_run_passes): Do not run front-end
         optimizations if a previous error occurred.

2018-03-27  Thomas Koenig  <tkoenig@gcc.gnu.org>

         PR fortran/85084
         * gfortran.dg/matmul_rank_1.f90: New test.
ig25@flaemmli:~/Krempel/MMICE>

Patch
diff mbox series

Index: frontend-passes.c
===================================================================
--- frontend-passes.c	(revision 258845)
+++ frontend-passes.c	(working copy)
@@ -156,6 +156,10 @@  gfc_run_passes (gfc_namespace *ns)
   check_locus (ns);
 #endif
 
+  gfc_get_errors (&w, &e);
+  if (e > 0)
+    return;
+
   if (flag_frontend_optimize || flag_frontend_loop_interchange)
     optimize_namespace (ns);
 
@@ -168,10 +172,6 @@  gfc_run_passes (gfc_namespace *ns)
       expr_array.release ();
     }
 
-  gfc_get_errors (&w, &e);
-  if (e > 0)
-   return;
-
   if (flag_realloc_lhs)
     realloc_strings (ns);
 }