[Patch, Fortran] PR 57022: [4.7/4.8/4.9 Regression] Inappropriate warning for use of TRANSFER with arrays

Janus Weil janus@gcc.gnu.org
Sun Apr 21 21:04:00 GMT 2013


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  <janus@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  <janus@gcc.gnu.org>

    PR fortran/57022
    * gfortran.dg/transfer_check_4.f90: New.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr57022_v2.diff
Type: application/octet-stream
Size: 5051 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20130421/bd66d77c/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: transfer_check_4.f90
Type: application/octet-stream
Size: 780 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20130421/bd66d77c/attachment-0001.obj>


More information about the Fortran mailing list