[PATCH] Fix PR fortran/18157 pointer to user-defined type and assignment
Andrew Pinski
pinskia@physics.uc.edu
Tue Oct 25 16:15:00 GMT 2005
The problem here is that we have a(1:2)%field = a(2:3)%field and we need a
temparory array to store the result of a(2:3)%field so that a(2)%field does
not get overwritten but we were using the wrong type. We used the type of
a(2) and not of a(2)%field. This patch fixes the problem by using the
type of the field rather than the type of the defined type.
OK? Bootstrapped and tested on x86_64-pc-linux-gnu with no regressions.
Also note I created three different testcases. The first two really should
not need an temporary array but current uses one (someone else needs to look
into that). The last one is the only one which really needs one.
Thanks,
Andrew Pinski
ChangeLog:
* trans-array.c (gfc_conv_resolve_dependencies): Use the correct
type of the temparory array.
* trans-expr.c (gfc_trans_assignment): Pass lss instead of lss_section
to gfc_conv_resolve_dependencies to get the correct type.
testsuite/ChangeLog:
* gfortran.fortran-torture/compile/defined_type_1.f90: New test.
* gfortran.fortran-torture/compile/defined_type_2.f90: New test.
* gfortran.fortran-torture/compile/defined_type_3.f90: New test.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: fixt.diff.txt
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20051025/b6f6f688/attachment.txt>
More information about the Fortran
mailing list