[patch, fortran] Fix checking of DIM argument ...

Daniel Kraft d@domob.eu
Wed Dec 31 08:31:00 GMT 2008


Daniel Franke wrote:
> ... for SUM, PRODUCT, MINVAL and MAXVAL on EXPR_ARRAY array arguments.
> 
> $> cat product.f90
>   print *, PRODUCT(RESHAPE((/ 1, 2, 3, 4 /), (/2, 2/)), DIM=0)
> END
> 
> $> gfortran-svn -Wall -W product.f90 && ./a.out
> Segmentation fault
> 
> [The RESHAPE was added as the library function seems to ignore them DIM 
> argument if the rank of ARRAY equals one.]
> 
> 
> With patch:
> $> gfortran-svn -Wall -W product.f90 && ./a.out
> product.f90:1.59:
> 
>   print *, PRODUCT(RESHAPE((/ 1, 2, 3, 4 /), (/2, 2/)), DIM=0)
>                                                            1
> Error: 'dim' argument of 'product' intrinsic at (1) is not a valid dimension 
> index
> 
> 
> gcc/fortran:
> 2008-12-30  Daniel Franke  <franke.daniel@gmail.com>
> 
> 	* check.c (dim_rank_check): Fixed checking of dimension argument
> 	if array is of type EXPR_ARRAY.
> 
> gcc/testsuite:
> 2008-12-30  Daniel Franke  <franke.daniel@gmail.com>
> 
> 	* gfortran.dg/mapping_2.f90: Fixed testcase.
> 
> 
> Regression tested on i686-pc-linux-gnu. Ok for trunk?

Ok, thanks for the patch!

Daniel

-- 
Done:  Arc-Bar-Cav-Rog-Sam-Tou-Val-Wiz
To go: Hea-Kni-Mon-Pri-Ran



More information about the Fortran mailing list