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: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: Mikael Morin <mikael dot morin at sfr dot fr>
- Cc: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Mon, 2 Nov 2015 07:18:42 -0800
- Subject: Re: [PATCH] PR fortran/68151 -- Check CASE selector for valid type
- Authentication-results: sourceware.org; auth=none
- References: <20151101211604 dot GA6694 at troutmask dot apl dot washington dot edu> <56374A05 dot 8060908 at sfr dot fr>
On Mon, Nov 02, 2015 at 12:33:25PM +0100, Mikael Morin wrote:
>
> 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.
>
Thanks for the correction. I'll update the comment
and check to see if F08:C832 is enforced
--
Steve