Fix enum comparisons
Steve Kargl
sgk@troutmask.apl.washington.edu
Wed Sep 3 00:53:00 GMT 2008
On Tue, Sep 02, 2008 at 05:03:57PM -0700, Ian Lance Taylor wrote:
> While testing a patch to warn about comparing different enum types in
> C, I ran into a couple of problems in the Fortran frontend. Here is
> the patch I wrote. I'm pretty sure about all of them except the first
> one, changing DIMEN_ELEMENT to AR_ELEMENT. Could somebody tell me
> whether that is correct? The existing code seems clearly wrong, but
> this patch will change how the compiler behaves. Thanks.
>
I believe your correct with the clearly wrong assessment, but
I'm not completely sure what the right patch is. Given the
definition of DIMEN_ELEMENT, the following comes to mind
@@ -991,12 +991,16 @@ static int need_full_assumed_size = 0;
static bool
check_assumed_size_reference (gfc_symbol *sym, gfc_expr *e)
{
+ int i;
+
if (need_full_assumed_size || !(sym->as && sym->as->type == AS_ASSUMED_SIZE))
return false;
- if ((e->ref->u.ar.end[e->ref->u.ar.as->rank - 1] == NULL)
+ i = e->ref->u.ar.as->rank - 1;
+
+ if ((e->ref->u.ar.end[i] == NULL)
&& (e->ref->u.ar.as->type == AS_ASSUMED_SIZE)
- && (e->ref->u.ar.type == DIMEN_ELEMENT))
+ && (e->ref->u.ar.dimen_type[i] == DIMEN_ELEMENT))
--
Steve
More information about the Fortran
mailing list