This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] PR fortran/68151 -- Check CASE selector for valid type
- From: Mikael Morin <mikael dot morin at sfr dot fr>
- To: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>, fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Mon, 2 Nov 2015 12:33:25 +0100
- Subject: Re: [PATCH] PR fortran/68151 -- Check CASE selector for valid type
- Authentication-results: sourceware.org; auth=none
- Authentication-results: sfrmc.priv.atos.fr; dkim=none (no signature); dkim-adsp=none (no policy) header dot from=mikael dot morin at sfr dot fr
- References: <20151101211604 dot GA6694 at troutmask dot apl dot washington dot edu>
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