Patchwork [fortran,0/5] PR54730 ICE: confused by type-like fonctions

login
register
mail settings
Submitter Mikael Morin
Date March 2, 2013, 6:18 p.m.
Message ID <51324265.8040308@sfr.fr>
Download mbox | patch
Permalink /patch/224520/
State New
Headers show

Comments

Mikael Morin - March 2, 2013, 6:18 p.m.
Le 22/02/2013 16:23, Tobias Burnus a écrit :
> Regarding the naming, can you use a bit more speaking names? For
> instance – without claiming that the naming choice is best:
> "undo_changes" instead of "changes", "emtpy_undo_change_set_var" instead
> of "change_set_var", "gfc_new_undo_checkpoint" instead of
> "gfc_new_checkpoint". It can be also something different, but it should
> imply what they a good for.
>
I'll change:

gfc_change_set			-> gfc_undo_change_set
change_set_var			-> default_undo_chgset_var
changes				-> latest_undo_chgset
gfc_new_checkpoint		-> gfc_new_undo_checkpoint
gfc_drop_last_checkpoint	-> gfc_drop_last_undo_checkpoint
gfc_restore_last_checkpoint	-> gfc_restore_last_undo_checkpoint
free_change_set_data		-> free_undo_change_set_data
pop_change_set			-> pop_undo_change_set


I attach the corresponding patches.
Will test and commit tomorrow.

Mikael

Patch

diff --git a/array.c b/array.c
index 6787c05..6ee292c 100644
--- a/array.c
+++ b/array.c
@@ -1046,6 +1046,7 @@  match
 gfc_match_array_constructor (gfc_expr **result)
 {
   gfc_constructor_base head, new_cons;
+  gfc_undo_change_set changed_syms;
   gfc_expr *expr;
   gfc_typespec ts;
   locus where;
@@ -1074,6 +1075,7 @@  gfc_match_array_constructor (gfc_expr **result)
 
   /* Try to match an optional "type-spec ::"  */
   gfc_clear_ts (&ts);
+  gfc_new_undo_checkpoint (changed_syms);
   if (gfc_match_decl_type_spec (&ts, 0) == MATCH_YES)
     {
       seen_ts = (gfc_match (" ::") == MATCH_YES);
@@ -1082,19 +1084,28 @@  gfc_match_array_constructor (gfc_expr **result)
 	{
 	  if (gfc_notify_std (GFC_STD_F2003, "Array constructor "
 			      "including type specification at %C") == FAILURE)
-	    goto cleanup;
+	    {
+	      gfc_restore_last_undo_checkpoint ();
+	      goto cleanup;
+	    }
 
 	  if (ts.deferred)
 	    {
 	      gfc_error ("Type-spec at %L cannot contain a deferred "
 			 "type parameter", &where);
+	      gfc_restore_last_undo_checkpoint ();
 	      goto cleanup;
 	    }
 	}
     }
 
-  if (! seen_ts)
-    gfc_current_locus = where;
+  if (seen_ts)
+    gfc_drop_last_undo_checkpoint ();
+  else
+    {
+      gfc_restore_last_undo_checkpoint ();
+      gfc_current_locus = where;
+    }
 
   if (gfc_match (end_delim) == MATCH_YES)
     {