This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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

>>> +  if ((source->expr_type == EXPR_ARRAY || source->rank > 0)
>> Minor: we can probably assume that rank > 0 if expr_type == EXPR_ARRAY,
> Side remark and just for completeness, there is also rank == -1 for
> assumed-rank arrays. However, as TRANSFER is not an inquiry function, it
> shouldn't reach that code. (Maybe you could quickly check that that's indeed
> the case.)

well, I guess you *can* actually reach that code with assumed-rank
arrays, e.g. via

subroutine assumed_rank (a)
  integer, intent(in) :: a(..)
  integer :: c(1:4)
  c = transfer(a,c,4)
end subroutine

So, good point! The code part quoted above has been removed in the
last revision, but I have updated gfc_target_expr_size to check for
"(e->rank)" now (i.e. without the "> 0"), and I have also added the
above test case (which indeed showed the false warning with the last
version of the patch, but not any more).

> Regarding the patch, I wonder whether the test case should also contain a
> CHARACTER one, motivated by PR 53685 (esp. comment 7).
> Please also include that PR in the ChangeLog.

Done. New patch attached. One more regtest, then commit ...

Thanks to everyone for the careful reviews!


2013-04-22  Janus Weil  <>

    PR fortran/53685
    PR fortran/57022
    * check.c (gfc_calculate_transfer_sizes): Fix for array-valued SOURCE
    * 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

2013-04-22  Janus Weil  <>

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

Attachment: pr57022_v4.diff
Description: Binary data

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]