[PATCH] PR fortran/68151 -- Check CASE selector for valid type
Mikael Morin
mikael.morin@sfr.fr
Mon Nov 2 11:33:00 GMT 2015
Hello Steve,
Le 01/11/2015 22:16, Steve Kargl a écrit :
> The attach patch add checking for a valid type during
> matching of a CASE selector. Built and regression
> tested on i386-*-freebsd. OK to commit?
[...]
> Index: gcc/fortran/match.c
> ===================================================================
> --- gcc/fortran/match.c (revision 229634)
> +++ gcc/fortran/match.c (working copy)
> @@ -5036,6 +5036,15 @@ match_case_selector (gfc_case **cp)
> goto need_expr;
> if (m == MATCH_ERROR)
> goto cleanup;
> +
> + /* F08:C830 case-expr shall be of type character, integer, or logical. */
case-expr is the expression appearing in a SELECT CASE statement (k in
the test), while here the problem is in a CASE statement, dealing with
value-expr's.
So I think C830 doesn't apply here. But you can rely on F08:C832 saying:
"For a given case-construct, each case-value shall be of the same
type as case-expr"
The type of case-expr is only checked in resolve_select, so the check
for the value-expr's should probably happen there as well.
Mikael
More information about the Fortran
mailing list