diff mbox

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

Message ID CAKwh3qj3nMyw_PRnyx7KiTXJ2aQH8_tgWEZwHwqs8wGRp3RwDw@mail.gmail.com
State New
Headers show

Commit Message

Janus Weil Jan. 9, 2014, 3:30 p.m. UTC
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.

Comments

Mikael Morin Jan. 11, 2014, 11:15 a.m. UTC | #1
Le 09/01/2014 16:30, Janus Weil a écrit :
> 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?
> 
Could you check whether it works with a regular error?
i.e. s/gfc_error_now/gfc_error/
If it doesn't, OK as is.

Thanks
Mikael
Janus Weil Jan. 12, 2014, 11:09 a.m. UTC | #2
2014/1/11 Mikael Morin <mikael.morin@sfr.fr>:
>
>
> Le 09/01/2014 16:30, Janus Weil a écrit :
>> 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?
>>
> Could you check whether it works with a regular error?
> i.e. s/gfc_error_now/gfc_error/
> If it doesn't, OK as is.

Good point. In fact in works just as well with a plain gfc_error.
Committed as r206564 with that change. Thanks for the review.

Cheers,
Janus
diff mbox

Patch

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: