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

Daniel Franke franke.daniel@gmail.com
Tue Dec 30 01:15:00 GMT 2008


... 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?

Regards

	Daniel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: dimcheck.diff
Type: text/x-patch
Size: 1000 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20081230/3bac628d/attachment.bin>


More information about the Fortran mailing list