[Patch, fortran] PR27089 - Module procedure with explicit result does not pass type to specification expression.

Paul Thomas paulthomas2@wanadoo.fr
Sun Apr 9 16:52:00 GMT 2006


:ADDPATCH fortran:

This patch fixes one of the bugs that prevents compilation of tonto-2.2.

The attached test case reproduces the error, which occurs on 
vec{int}.F90, line 804 of tonto.

 In file test.f90:19
      integer(4), dimension(n_elements_uncommon_with_(x)) :: res
                           1
Error: Expression at (1) must be of INTEGER type
 In file test.f90:19
Repeated four times.

This comes about because resolve_array_bound calls gfc_resolve_expr, 
which should provide the type of the function for the subsequent call to 
gfc_specification expression.  In this particular case of an explicit 
result, the type is not found because resolve_generic_f0 only tries to 
lift the type from the symbol.  The patch tests if this has the type 
set.  If it is not, the presence of an explicit result is tested and its 
type is used, if there.  I have extended this to the rank as well, on 
the grounds that it cannot do any harm and that it might even be needed.

Regtested on FC3/Athlon1700.  OK fro trunk and 4.1?

Paul

2006-04-09  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/27089
    * resolve.c (resolve_generic_f0): Transfer type and rank to the
    expression from the explicit result, if the symbol does not
    have them.

2006-04-09  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/27089
    * gfortran.dg/specification_type_resolution_1.f90: New test.



-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: resolve.diff
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20060409/f3779271/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: specification_type_resolution_1.f90
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20060409/f3779271/attachment.f90>


More information about the Fortran mailing list