[Patch 2/2, Fortran, pr60322 a.o.] [OOP] Incorrect bounds on polymorphic dummy array

Andre Vehreschild vehre@gmx.de
Thu Feb 26 17:18:00 GMT 2015


Hi all,

here is the second part of the patch for pr60322. This patch also addresses the
issue reported in pr64692, ... (more to come).

The patch fixes the incorrect bounds of polymorphic arrays used to call
functions and subroutines by using the same mechanism as regular arrays. In
fact most of the code for treating regular arrays is reused by simply inserting
the class array's symbol_attributes and gfc_array_specs into the same routines,
i.e., doing the switching whether a symbol is a class array or a regular array
and assigning the CLASS_DATA(sym).attr or sym.attr to the symbol_attribute
temporary variable introduced by the first part (same for gfc_array_spec). The
temporary array descriptor is then stored in the tree and extracted were it is
needed.

This patch furthermore addresses an issue with elemental functions, where the
elemental function was not applied to class array members. By introducing the
temporary array this merely fixed itself.

During fixing elemental function application, an issue about using the
polymorphic initializer popped up. The existing code would declare a variable
of the base type (not a reference or pointer to it), assign the _vptr's
_def_init to it and use the _vptr's _copy to copy the initializer into the
object to initialize. This had to be patched to use a pointer for the variable
and the correct addressing to be able to make use of the polymorphic init.

Furthermore is the array offset in certain cases set to be -1. This helped to
get the addressing correct for subarrays of (unlimited polymorphic) objects,
where the array offset is used in a "select type" or other kind of association
and the with the offset set incorrectly wrong elements from the array were
selected.

I had to fix two testcases, too:
- finalize_15: We agreed (including checking with other compilers) that the
  value of an intent(out) variable should be that of its initializer and not
  that of its finalizer.
- finalize_10: By using the temporary arrays the scan-tree-count expressions
  had to be adapted, too.

Thank you's go to: Tobias, Dominique and Paul for their support during figuring
what it going wrong and thorough testing and to Antony for reporting the issue.

Bootstraps and regtests ok on x86_64-linux-gnu/F20.

Regards,
	Andre
-- 
Andre Vehreschild * Email: vehre ad gmx dot de 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr60322_1.clog
Type: application/octet-stream
Size: 2394 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20150226/225d036e/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr60322_1.patch
Type: text/x-patch
Size: 40600 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20150226/225d036e/attachment.bin>


More information about the Fortran mailing list