[PATCH 09/10] fortran: Support clobbering of variable subreferences [PR88364]
Harald Anlauf
anlauf@gmx.de
Tue Sep 20 21:08:54 GMT 2022
Am 19.09.22 um 22:50 schrieb Mikael Morin:
> Le 19/09/2022 à 21:46, Harald Anlauf a écrit :
>> Am 18.09.22 um 22:55 schrieb Mikael Morin:
>>> Le 18/09/2022 à 20:32, Harald Anlauf a écrit :
>>>>
>>>> Assumed shape will be on the easy side,
>>>> while assumed size likely needs to be excluded for clobbering.
>>>>
>>> Isn’t it the converse that is true?
>>> Assumed shape can be non-contiguous so have to be excluded, but assumed
>>> size are contiguous, so valid candidates for clobbering. No?
>>
>> I really was referring here to *dummies*, as in the following example:
>>
>> program p
>> integer :: a(4)
>> a = 1
>> call sub (a(1), 2)
>> print *, a
>> contains
>> subroutine sub (b, k)
>> integer, intent(in) :: k
>> integer, intent(out) :: b(*)
>> ! integer, intent(out) :: b(k)
>> if (k > 2) b(k) = k
>> end subroutine sub
>> end program p
>>
>> Assumed size (*) is just a contiguous hunk of memory of possibly
>> unknown size, which can be zero. So you couldn't set a clobber
>> for the a(1) actual argument.
>>
> Couldn't you clobber A entirely? If no element of B is initialized in
> SUB, well, A has undefined values on return from SUB. That's how
> INTENT(OUT) works.
>
I think I understand much of what is said, but I feel that I do
not really understand what *clobber* means for the different
beasts we are discussing (although I have an impression of what
it means for a scalar object).
More information about the Fortran
mailing list