------- Comment #1 from burnus at gcc dot gnu dot org  2010-06-20 20:52 -------
See below for a match.c patch. However, it will fail as the labels are not
available. In principle, one just needs to add:

  tree exit_label;
  /* The exit label.  */
  exit_label = gfc_build_label_decl (NULL_TREE);
  code->block->backend_decl = tree_cons (NULL, exit_label, NULL);
  stmt = build1_v (LABEL_EXPR, exit_label);
  gfc_add_expr_to_block (&if_se.pre, stmt);

to all constructs (in trans-stmt.c) as then trans_exit's

  exit_label = TREE_VALUE (code->ext.whichloop->backend_decl);

would work. However, this fails for instance for the IF block as there
"code->block" is only available if an ELSE branch exists.


Index: match.c
===================================================================
--- match.c     (Revision 161045)
+++ match.c
@@ -2034,6 +2034,13 @@ match_exit_cycle
                  gfc_ascii_statement (st));
        return MATCH_ERROR;
       }
+    else if (sym == p->sym)
+      {
+       if (gfc_notify_std (GFC_STD_F2008, "Fortran 2008: EXIT with no "
+                           "do-construct-name at %C") == FAILURE)
+         return MATCH_ERROR;
+       break;
+      }

   if (p == NULL)
     {
@@ -2041,7 +2048,7 @@
        gfc_error ("%s statement at %C is not within a loop",
                   gfc_ascii_statement (st));
       else
-       gfc_error ("%s statement at %C is not within loop '%s'",
+       gfc_error ("%s statement at %C is not within construct '%s'",
                   gfc_ascii_statement (st), sym->name);

       return MATCH_ERROR;


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44602

Reply via email to