The following contains a few testcases for MAXLOC, at least one of them is not working (some other cases depend on PR12703 (ALLOCATE(C(0))) INTEGER :: B(3) INTEGER, POINTER, DIMENSION(:) :: C INTEGER, POINTER, DIMENSION(:,:) :: D B=0 IF (MAXLOC(B,1).NE.1) CALL ABORT() B(1)=1 B(2)=0 B(3)=1 IF (MAXLOC(B,1).NE.1) CALL ABORT() B=-HUGE(1) IF (MAXLOC(B,1).NE.1) CALL ABORT() ALLOCATE(C(0)) IF (MAXLOC(C,1).NE.0) CALL ABORT() ALLOCATE(D(1,0)) IF (ANY(MAXLOC(D).NE.(/0,0/))) CALL ABORT() END
First 3 test succeed. Last 2 tests indeterminate as allocate(0) fails.
Subject: Bug 12704 CVSROOT: /cvs/gcc Module name: gcc Branch: tree-ssa-20020619-branch Changes by: pbrook@gcc.gnu.org 2003-11-08 16:12:36 Modified files: gcc/fortran : ChangeLog trans-intrinsic.c gcc/testsuite : ChangeLog.tree-ssa gcc/testsuite/gfortran.fortran-torture/execute: intrinsic_mmloc_3.f90 libgfortran : ChangeLog libgfortran/generated: all_l4.c all_l8.c any_l4.c any_l8.c count_4_l4.c count_4_l8.c count_8_l4.c count_8_l8.c maxloc0_4_i4.c maxloc0_4_i8.c maxloc0_4_r4.c maxloc0_4_r8.c maxloc0_8_i4.c maxloc0_8_i8.c maxloc0_8_r4.c maxloc0_8_r8.c maxloc1_4_i4.c maxloc1_4_i8.c maxloc1_4_r4.c maxloc1_4_r8.c maxloc1_8_i4.c maxloc1_8_i8.c maxloc1_8_r4.c maxloc1_8_r8.c maxval_i4.c maxval_i8.c maxval_r4.c maxval_r8.c minloc0_4_i4.c minloc0_4_i8.c minloc0_4_r4.c minloc0_4_r8.c minloc0_8_i4.c minloc0_8_i8.c minloc0_8_r4.c minloc0_8_r8.c minloc1_4_i4.c minloc1_4_i8.c minloc1_4_r4.c minloc1_4_r8.c minloc1_8_i4.c minloc1_8_i8.c minloc1_8_r4.c minloc1_8_r8.c minval_i4.c minval_i8.c minval_r4.c minval_r8.c product_c4.c product_c8.c product_i4.c product_i8.c product_r4.c product_r8.c sum_c4.c sum_c8.c sum_i4.c sum_i8.c sum_r4.c sum_r8.c libgfortran/m4 : all.m4 any.m4 count.m4 iforeach.m4 ifunction.m4 maxloc0.m4 maxloc1.m4 maxval.m4 minloc0.m4 minloc1.m4 minval.m4 product.m4 sum.m4 Added files: gcc/testsuite/gfortran.fortran-torture/execute: intrinsic_mmloc_4.f90 Log message: PR fortran/12704 * trans-intrinsic.c (gfc_conv_intrinsics_minmaxloc): Handle zero-size arrays. libgfortran * m4/maxloc0.m4: Use default value of 1. Handle zero sized arrays. * m4/maxloc1.m4: Ditto. * m4/minloc0.m4: Ditto. * m4/minloc1.m4: Ditto. * m4/ifunction.m4: Set return value for zero sized arrays. * m4/iforeach.m4: Ditto. * m4/all.m4, m4/any.m4, m4/count.m4, m4/maxloc1.m4, m4/minloc1.m4, m4/mxaval.m4, m4/minval.m4, m4/product.m4, m4/sum.m4: Ditto. * generated/*: Update. testsuite * gfortran.fortran-toriture/execute/intrinsic_mmloc_3.f90: Extra test. * gfortran.fortran-toriture/execute/intrinsic_mmloc_4.f90: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.70&r2=1.1.2.71 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-intrinsic.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.18&r2=1.1.2.19 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.tree-ssa.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.105&r2=1.1.2.106 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_mmloc_4.f90.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=NONE&r2=1.1.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.fortran-torture/execute/intrinsic_mmloc_3.f90.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.1&r2=1.1.2.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/ChangeLog.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.20&r2=1.1.2.21 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/all_l4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/all_l8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/any_l4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/any_l8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/count_4_l4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/count_4_l8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/count_8_l4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/count_8_l8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/maxloc0_4_i4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/maxloc0_4_i8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/maxloc0_4_r4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/maxloc0_4_r8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/maxloc0_8_i4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/maxloc0_8_i8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/maxloc0_8_r4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/maxloc0_8_r8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/maxloc1_4_i4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/maxloc1_4_i8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/maxloc1_4_r4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/maxloc1_4_r8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/maxloc1_8_i4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/maxloc1_8_i8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/maxloc1_8_r4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/maxloc1_8_r8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/maxval_i4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/maxval_i8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/maxval_r4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/maxval_r8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/minloc0_4_i4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/minloc0_4_i8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/minloc0_4_r4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/minloc0_4_r8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/minloc0_8_i4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/minloc0_8_i8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/minloc0_8_r4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/minloc0_8_r8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/minloc1_4_i4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/minloc1_4_i8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/minloc1_4_r4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/minloc1_4_r8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/minloc1_8_i4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/minloc1_8_i8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/minloc1_8_r4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/minloc1_8_r8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/minval_i4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/minval_i8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/minval_r4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/minval_r8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/product_c4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/product_c8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/product_i4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/product_i8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/product_r4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/product_r8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/sum_c4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/sum_c8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/sum_i4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/sum_i8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/sum_r4.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/generated/sum_r8.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/all.m4.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/any.m4.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/count.m4.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/iforeach.m4.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/ifunction.m4.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/maxloc0.m4.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/maxloc1.m4.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/maxval.m4.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/minloc0.m4.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/minloc1.m4.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/minval.m4.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/product.m4.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libgfortran/m4/sum.m4.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3
F95 does not specify what the return value with zero sized arrays should be ("implementation defined"). F2k specifies it must be zero, so I did that.