[Patch, Fortran] PR 58026: Bad error recovery for allocatable component of undeclared type

Janus Weil janus@gcc.gnu.org
Thu Jan 9 15:30:00 GMT 2014


Hi all,

the attached patch started out as an ICE-on-invalid regression fix,
but after the ICE had been fixed recently by other means, it was
degraded to a mere error-recovery improvement. It removes some rather
'hackish' code that was added by Paul quite a long time ago.

Regtests cleanly on x86_64-unknown-linux-gnu. Ok for trunk?

Cheers,
Janus


2014-01-09  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/58026
    * decl.c (gfc_match_data_decl): Improve error recovery.


2014-01-09  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/58026
    * gfortran.dg/alloc_comp_basics_6.f90: New.
-------------- next part --------------
Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c	(revision 206462)
+++ gcc/fortran/decl.c	(working copy)
@@ -4287,12 +4287,10 @@ gfc_match_data_decl (void)
 	      || current_ts.u.derived->attr.zero_comp))
 	goto ok;
 
-      /* Now we have an error, which we signal, and then fix up
-	 because the knock-on is plain and simple confusing.  */
       gfc_error_now ("Derived type at %C has not been previously defined "
 		     "and so cannot appear in a derived type definition");
-      current_attr.pointer = 1;
-      goto ok;
+      m = MATCH_ERROR;
+      goto cleanup;
     }
 
 ok:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alloc_comp_basics_6.f90
Type: text/x-fortran
Size: 248 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20140109/84d5d66e/attachment.bin>


More information about the Gcc-patches mailing list