[PATCH, v2] Fortran: fix invalid rank error in ASSOCIATED when rank is remapped [PR77652]

Harald Anlauf anlauf@gmx.de
Fri Jul 29 20:01:55 GMT 2022


Am 28.07.22 um 22:19 schrieb Mikael Morin:
> Hello,
> 
> Le 27/07/2022 à 21:45, Harald Anlauf via Fortran a écrit :
>> ok, I have thought about your comments in the review process,
>> and played with the Cray compiler.  Attached is a refined version
>> of the patch that now rejects in addition these cases for which there
>> are no possible related pointer assignments with bounds remapping:
>>
>>    ASSOCIATED (scalar, array) ! impossible, cannot remap bounds
>>    ASSOCIATED (array, scalar) ! a scalar is not simply contiguous
>>
> In principle, it could make sense to construct a one-sized array pointer 
> (of any rank) pointing to a scalar, but I agree that if we follow the 
> rules of the standard to the letter, it should be rejected (and we do 
> reject such a pointer assignment).
> So, with this case eliminated, this patch looks good to me as is.

OK, so I will push that version soon.

> Regarding Toon’s suggestion to ask the fortran committee, it sounds 
> sensible.  I propose to prepare something tomorrow.
> 

Depending on the answer we can later refine the compile-time check
and relax if needed.

Harald



More information about the Gcc-patches mailing list