This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Ok, here is the follow-up patch, which removes the warning on
(alternate) RETURN statements, in order to avoid double diagnostics.

However, it also adds another warning for alternate-return actual
arguments (in addition to the formal ones), in order to catch
additional cases, which were not warned for up to now (e.g.
altreturn_{1,4}). Unfortunately this again introduces some potentially
redundant warnings, but I hope this is not too bad.

The patch also adds -std=gnu consistently for all altreturn_* cases.
(In altreturn_5.f90 there apparently were some superfluous control
characters, which were removed by my editor.)

Regtested on x86_64-unknown-linux-gnu. Ok for trunk?

Cheers,
Janus


2013-04-03  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/40881
    * match.c (gfc_match_return): Remove standard notification.
    * primary.c (gfc_match_actual_arglist): Add standard notification.

2013-04-03  Janus Weil  <janus@gcc.gnu.org>

    PR fortran/40881
    * gfortran.dg/altreturn_1.f90: Add -std=gnu.
    * gfortran.dg/altreturn_4.f90: Ditto.
    * gfortran.dg/altreturn_3.f90: Replace -std=legacy by -std=gnu.
    * gfortran.dg/altreturn_5.f90: Ditto.
    * gfortran.dg/altreturn_6.f90: Ditto.
    * gfortran.dg/altreturn_7.f90: Ditto.




2013/4/3 Janus Weil <janus@gcc.gnu.org>:
>>>> 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.
>
> I have just committed the patch as 197389.
>
> Will take care of removing the double diagnostics next. Also I just
> noticed that there still seem to be cases where one does not get a
> warning for alternate return (such as altreturn_1 and altreturn_4 in
> the testsuite).
>
> 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.
>>>
>>>

Attachment: altreturn.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]