http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56284
--- Comment #10 from janus at gcc dot gnu.org 2013-02-12 13:31:22 UTC ---
(In reply to comment #9)
> Do you understand why the test in gfc_match_return (file match.c)
>
> if (gfc_notify_std (GFC_STD_F95_OBS, "Alternate RETURN "
> "at %C") == FAILURE)
> return MATCH_ERROR;
>
> is not used?
Yeah. The reason is that this one only triggers on an actual RETURN statement,
but not if an unused alt-return argument is declared (as e.g. in comment 2).
> Note that the error is slightly different to the one used in comment #5.
Yes, I did that on purpose, since both warn for slightly different things: The
former for an ('alternate') RETURN statement and the latter for an
alternate-return dummy argument.
In fact one could think about removing the error message in gfc_match_return
and only keeping the one in gfc_match_formal_arglist. After all it makes no
sense to have an alternate RETURN statement without an alternate-return dummy.
However, since gfortran only gives a warning for this case(*), I think it does
not hurt to keep both error messages.
(*) "Warning: An alternate return at (1) without a * dummy argument"