This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, Fortran] PR 57022: [4.7/4.8/4.9 Regression] Inappropriate warning for use of TRANSFER with arrays
- From: Janus Weil <janus at gcc dot gnu dot org>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: Mikael Morin <mikael dot morin at sfr dot fr>, gfortran <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 22 Apr 2013 21:27:48 +0200
- Subject: Re: [Patch, Fortran] PR 57022: [4.7/4.8/4.9 Regression] Inappropriate warning for use of TRANSFER with arrays
- References: <CAKwh3qjxDpd4gBqyh1fRoDgnm4t4rMz+BKZLEDAJqny0iyk0hg at mail dot gmail dot com> <51753EBD dot 7000304 at sfr dot fr> <51755EDD dot 7070801 at net-b dot de> <CAKwh3qg4-HJp9m6ySqwoec90XV2Fwo1cd6DMvVf5JwJnJTAmMA at mail dot gmail dot com> <517581AA dot 80605 at net-b dot de>
2013/4/22 Tobias Burnus <burnus@net-b.de>:
> Am 22.04.2013 20:00, schrieb Janus Weil:
>>>
>>> >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).
>
>
> Checking for "rank" instead of "rank >0" is fine - but I wouldn't add the
> test case as it is invalid
ok, committed as r198155.
Will backport to 4.8 and 4.7 in about a week or so ...
> and gfortran should reject the code according
> to the following TS29113 constraint:
>
> "C535b An assumed-rank variable name shall not appear in a designator or
> expression except as an actual argument corresponding to a dummy argument
> that is assumed-rank, the argument of the C_LOC function in the
> ISO_C_BINDING intrinsic module, or the first argument in a reference to an
> intrinsic inquiry function."
>
> Seemingly, the constraint code is not correctly checked for intrinsics as
> TRANSFER is a transformational function.
>
> I wonder whether TYPE(*) and !GCC$ attributes no_arg_check have the same
> problems as similar constraints exist for those.
>
> I have now filled: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57035
Ok, thanks!
Cheers,
Janus