[Patch, fortran, pr66578, v1] [F2008] Invalid free on allocate(...,source=a(:)) in block
Andre Vehreschild
vehre@gmx.de
Mon Jul 6 12:58:00 GMT 2015
Hi all,
this is a proposal to patch PR 66578
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66578 . It extends work of Mikael
Morin. The patch fixes two issues:
1. a source'd allocate in a block: allocate(c, source=a(:)). The issues occurs
because due to the new handling of source-expressions in trans_allocate() an
array descriptor is created where previously just a plain array was used. I.e.,
GFC_DESCRIPTOR_TYPE_P (source) is true now and GFC_ARRAY_TYPE_P (source) false,
which made gfortran use the wrong bounds for the descriptor (zero-based instead
of one-based). This was fixed by Mikael's proposal.
2. a two-level array addressing lead to a segfault. I.e., when in a
source-expression an array was used to index another object, then the offset
was computed incorrectly.
Bootstraps and regtests fine on x86_64-linux-gnu/f21.
Comments welcome!
Regards,
Andre
PS: Experience shows that asking whether this ok for trunk is useless ;-) There
is always something that could be improved. Open for suggestions.
--
Andre Vehreschild * Email: vehre ad gmx dot de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr66578_1.clog
Type: application/octet-stream
Size: 354 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20150706/f515b08f/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr66578_1.patch
Type: text/x-patch
Size: 5058 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20150706/f515b08f/attachment.bin>
More information about the Fortran
mailing list