[Patch, fortran] PR31564 - Error: Type/rank mismatch in argument

Paul Richard Thomas paul.richard.thomas@gmail.com
Wed Sep 5 09:46:00 GMT 2007


:ADDPATCH fortran:

This PR arises from the behaviour of gfc_simplify_expr, when faced
with a variable array reference to a component of a derived type
parameter.  Such references to parameter arrays are separated off as
variable expressions in gfc_match_rvalue and the solution in this case
is to do the same.  The patch does not check for variable references
and so treats all array references in the same way.  This could be
changed but I have seen no need to do so.

A slight wrinkle is that references to use associated derived type
references fail to find an external link with the mangled name.  This
has been dealt with by resetting attr.use_assoc and setting
sym->module to NULL.

The testcase is basically the contributors.

Bootstrapped and regtested on x86_ia64/FC5 - OK for trunk?

Paul

2007-09-05  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/31564
	* primary.c (gfc_match_rvalue): Make expressions that refer
	to derived type parameters that have array references into
	variable expressions.  Remove references to use association
	from the symbol.

2007-09-05  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/31564
	* gfortran.dg/derived_comp_array_ref_2.f90: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr31564.diff
Type: application/octet-stream
Size: 2511 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070905/ad6a3e65/attachment.obj>


More information about the Gcc-patches mailing list