[patch, fortran] Fix PR 26039, lack of conformance checking in some intrinsics
Paul Thomas
paulthomas2@wanadoo.fr
Tue Jan 31 07:05:00 GMT 2006
Thomas,
>
>+ if (m != NULL && m->rank != 0 && m->rank != a->rank)
>+ {
>+ gfc_error ("'%s' argument of '%s' intrinsic at %L must be conformable "
>+ "with '%s' argument", gfc_current_intrinsic_arg[0],
>+ gfc_current_intrinsic, &a->where,
>+ gfc_current_intrinsic_arg[2]);
>+ return FAILURE;
>+
>+ }
> return SUCCESS;
> }
>
>
>
>
You are not testing for conformance - just equal ranks. Why don't you
use gfc_check_conformance (const char*, gfc_expr *, gfc_expr*), which
will check the shapes as well? The standard does actually specify
conformability.
>! { dg-do compile }
>! PR 26039: Tests for different ranks for (min|max)loc, (min|max)val, product
>! and sum were missing.
>program main
> integer, dimension(2) :: a
> logical, dimension(2,1) :: lo
> a = (/ 1, 2 /)
> lo = .true.
> print *,minloc(a,mask=lo) ! { dg-error "must be conformable with 'mask' argument" }
> print *,maxloc(a,mask=lo) ! { dg-error "must be conformable with 'mask' argument" }
> print *,minval(a,mask=lo) ! { dg-error "must be conformable with 'mask' argument" }
> print *,maxval(a,mask=lo) ! { dg-error "must be conformable with 'mask' argument" }
> print *,sum(a,mask=lo) ! { dg-error "must be conformable with 'mask' argument" }
> print *,product(a,mask=lo) ! { dg-error "must be conformable with 'mask' argument" }
> print *,minloc(a,1,mask=lo) ! { dg-error "must be conformable with 'mask' argument" }
> print *,maxloc(a,1,mask=lo) ! { dg-error "must be conformable with 'mask' argument" }
> print *,minval(a,1,mask=lo) ! { dg-error "must be conformable with 'mask' argument" }
> print *,maxval(a,1,mask=lo) ! { dg-error "must be conformable with 'mask' argument" }
> print *,sum(a,1,mask=lo) ! { dg-error "must be conformable with 'mask' argument" }
> print *,product(a,1,mask=lo) ! { dg-error "must be conformable with 'mask' argument" }
>end program main
>
>
Ditto.
Cheers
Paul
More information about the Gcc-patches
mailing list