[patch, fortran] PR32906 - Parameter array ... cannot be automatic or assumed shape

Daniel Franke franke.daniel@gmail.com
Thu Jul 26 22:35:00 GMT 2007


This seems to be a 2-in-1: not only the error was unjustified, but the message 
was also incorrectly worded. Consider

   integer, parameter :: len = 1
   integer, parameter :: arr(max(len,1)) = (/1/)
   end

where gfortran complains:
   Parameter array 'arr' at (1) cannot be automatic or assumed shape

As an assumed shape array is a "nonpointer dummy argument array" (5.1.2.4.2), 
parameter arrays can not be of assumed shape as dummy arguments are not 
allowed to have the parameter attribute (5.1, constraint of R503). Instead, 
arrays of deferred shape, i.e. an "allocatable array or an array pointer" 
(5.1.2.4.3), must be rejected (see also gfortran.dg/shape_1.f90). 

Acoordingly, the test for parameter arrays as well as the error message was 
adjusted to fix these problems.


gcc/fortran:
2007-07-26  Daniel Franke  <franke.daniel@gmail.com>

	PR fortran/32906
	* resolve.c (resolve_fl_parameter): Check for constant shape arrays, 
	adjusted error message.

gcc/testsuite:
2007-07-26  Daniel Franke  <franke.daniel@gmail.com>

	PR fortran/32906
	* gfortran.dg/shape_1.f90: Adjust error message.
	* gfortran.dg/parameter_array_ref_1.f90: New test.


Regression tested on i686-pc-linux-gnu. Ok for trunk?

Regards
	Daniel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr32906.patch
Type: text/x-diff
Size: 2148 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070726/98dc5c48/attachment.bin>


More information about the Gcc-patches mailing list