Hi all,

the attached patch fixes an regression with TRANSFER, which was just
reported today. The problem was that array-valued SOURCE arguments
were not treated correctly.

To fix it properly, I had to make 'gfc_target_expr_size' behave
correctly for arrays and introduced an new function 'gfc_element_size'
(which, contrary to the former, returns the size of one array element
instead of the whole expression).

In the process I could also remove the small function 'size_array' and
had to make some more adjustments in simlify.c, in order to account
for the slightly modified (and now more consistent) behavior of
'gfc_target_expr_size'.

Regtested on x86_64-unknown-linux-gnu. Ok for trunk? 4.7/4.8?

Cheers,
Janus



2013-04-21  Janus Weil  <ja...@gcc.gnu.org>

    PR fortran/57022
    * check.c (gfc_calculate_transfer_sizes): Fix for array-valued SOURCE
    expressions.
    * simplify.c (gfc_simplify_sizeof,gfc_simplify_storage_size): Get rid
    of special treatment for EXPR_ARRAY.
    * target-memory.h (gfc_element_size): New prototype.
    * target-memory.c (size_array): Remove.
    (gfc_element_size): New function.
    (gfc_target_expr_size): Modified to always return the full size of the
    expression.


2013-04-21  Janus Weil  <ja...@gcc.gnu.org>

    PR fortran/57022
    * gfortran.dg/transfer_check_4.f90: New.

Attachment: pr57022_v2.diff
Description: Binary data

Attachment: transfer_check_4.f90
Description: Binary data

Reply via email to