[Patch, Fortran, OOP] PR 56284: ICE with alternate return in type-bound procedure

Janus Weil janus@gcc.gnu.org
Mon Apr 1 22:59:00 GMT 2013


>> here is a small patch which does two things:
>> 1) It fixes the ICE in the subject line (in a rather obvious way).
>> 2) It warns about alternate-return arguments (which is an obsolescent
>> feature), and adds -std=legacy to some test cases to suppress the
>> warning.
>
> I would prefer if you could use "-std=gnu", I find -std=legacy is too
> special. Alternate-returns are perfectly valid in Fortran 2008 - the
> standard just requires the obsolescent warning, which
> -std=f95/f2003/f2008/f2008ts activate.  And by default "-pedantic". Using ""
> or "-std=gnu" should be sufficient to disable "-pedantic".

Ok with me. However, the other altreturn_* tests all have -std=legacy
(for whatever reason). Doesn't make a whole lot of difference, I guess
...

Out of curiosity I just checked: The gfortran.dg directory has ~120
tests with -std=legacy and ~60 with -std=gnu.


>> Regarding the second point, one should mention that we already have a
>> warning for "alternate return", but this only triggers if there is an
>> actual RETURN statement (which is not the case for the test code in
>> the PR). The warning I'm adding triggers on the appearance of an
>> asterisk argument.
>
> Shouldn't one then remove the other warning, which should be then
> unreachable? If so, please do so.

Yes, will do so in a follow-up patch.


>> This induces a certain redundancy, i.e. we warn about both the
>> alternate-return argument and the alternate RETURN statement. The
>> question is if we want to keep this, or whether on can remove the old
>> warning for the RETURN statement (which could be done in a follow-up
>> patch).
>
> Or it is not unreachable but leads to double-diagnostic which is not better,
> either.

Right.


>> The patch is regtested on x86_64-unknown-linux-gnu. Ok for trunk?
>
> OK with the -std= change. (Please run "make
> RUNTESTFLAGS="dg.exp=.<name>.f90" prior committal to check whether it indeed
> works with -std=gnu.)

All of them still work with std=gnu.


> Thanks for the patch!

Thanks for the review!

Cheers,
Janus



>> 2013-04-01  Janus Weil  <janus@gcc.gnu.org>
>>
>>      PR fortran/56284
>>      PR fortran/40881
>>      * decl.c (gfc_match_formal_arglist): Warn about alternate-return
>>      arguments.
>>      * interface.c (check_dummy_characteristics): Return if symbols are
>> NULL.
>>
>> 2013-04-01  Janus Weil  <janus@gcc.gnu.org>
>>
>>      PR fortran/56284
>>      PR fortran/40881
>>      * gfortran.dg/altreturn_8.f90: New.
>>      * gfortran.dg/altreturn_2.f90: Add -std=legacy.
>>      * gfortran.dg/intrinsic_actual_3.f90: Ditto.
>>      * gfortran.dg/invalid_interface_assignment.f90: Ditto.
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr56284_v2.diff
Type: application/octet-stream
Size: 2406 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20130401/80017652/attachment.obj>


More information about the Gcc-patches mailing list