[PATCH, v2] PR fortran/103418 - random_number() does not accept pointer, intent(in) array argument

Mikael Morin morin-mikael@orange.fr
Fri Dec 10 12:28:37 GMT 2021


On 09/12/2021 23:05, Harald Anlauf wrote:
> Hi Mikael,
> 
> Am 08.12.21 um 10:32 schrieb Mikael Morin:
>> On 07/12/2021 21:46, Harald Anlauf wrote:
>>> Hi Mikael,
>>>
>>> Am 07.12.21 um 21:17 schrieb Mikael Morin:
>>>> The existing code looks dubious to me (or at least difficult to
>>>> understand), and your patch doesn’t make that any better.
>>>> I would rather try to remove the whole block, and fix the fallout on
>>>> move_alloc by adding calls to gfc_check_vardef_context in
>>>> gfc_check_move_alloc.
>>>> Can you try that instead?
>>>
>>> I hadn't thought that far but will think about a possibly better
>>> solution.
>>>
>> Hello,
>>
>> I thought about it some more over night, and it is probably a poor
>> suggestion to restrict the check to move_alloc only.  The existing code
>> was added for move_alloc, but it has a broader scope.  Still,
>> gfc_check_vardef_context has the correct checks and is the one to be 
>> used.
> 
> I have played a little, and it took some time to understand the fallout.
> Your suggestion to rely on gfc_check_vardef_context actually helped to
> uncover another bug: a bad check for CLASS pointer.
> 
Reading gfc_check_vardef_context, I have undersood what the existing 
code was doing, and why.  It was not that dubious after all.  Still, I 
prefer the v2 much.

> See attached for an updated patch and the extended testcase.
> 
> Regtested again.  OK now?
> 
Yes, thanks.


More information about the Fortran mailing list