[patch, fortran] PR 37721, warn about target > source in TRANSFER

Thomas Koenig tkoenig@netcologne.de
Fri Aug 5 20:39:00 GMT 2011


Hello world,

the attached patch fixes PR 37721 by moving the check for TRANSFER size 
mismatches to checking, away from simplification.  That means that it is 
possible to check character MOLDs whose size is constant, but which 
aren't constant themselves.

I added the extra argument to gfc_target_interpret_expr because for a 
TRANSFER, we want a binary copy and not a conversion between wide and
normal characters.

Regression-tested.  OK for trunk?

	Thomas

2011-08-05  Thomas Koenig  <tkoenig@gcc.gnu.org>

         PR fortran/37221
         * gfortran.h (gfc_calculate_transfer_sizes):  Add prototype.
         * target-memory.h (gfc_target_interpret_expr):  Add boolean
         argument wether to convert wide characters.
         * target-memory.c (gfc_target_expr_size):  Also return length
         of characters for non-constant expressions if these can be
         determined from the cl.
         (interpret_array):  Add argument for gfc_target_interpret_expr.
         (gfc_interpret_derived):  Likewise.
         (gfc_target_interpret_expr):  Likewise.
         * check.c:  Include target-memory.h.
         (gfc_calculate_transfer_sizes):  New function.
         (gfc_check_transfer):  When -Wsurprising is in force, calculate
         sizes and warn if result is larger than size (check moved from
         gfc_simplify_transfer).
         * simplify.c (gfc_simplify_transfer):  Use
         gfc_calculate_transfer_sizes.  Remove warning.

2011-08-05  Thomas Koenig  <tkoenig@gcc.gnu.org>

         PR fortran/37221
         * gfortran.dg/transfer_check_2.f90:  New test case.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p3.diff
Type: text/x-patch
Size: 9806 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20110805/37a49128/attachment.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: transfer_check_2.f90
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20110805/37a49128/attachment.f90>


More information about the Fortran mailing list