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  <ja...@gcc.gnu.org>

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


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

    PR fortran/58026
    * gfortran.dg/alloc_comp_basics_6.f90: New.
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:
! { dg-do compile }
!
! PR 58026: Bad error recovery for allocatable component of undeclared type
!
! Contributed by Joost VandeVondele <joost.vandevond...@mat.ethz.ch>

  type sysmtx_t
     type(ext_complex_t), allocatable :: S(:)
  end type

end

Reply via email to