[PATCH, v2] Fortran: use name of array component in runtime error message [PR30802]

Mikael Morin morin-mikael@orange.fr
Fri Mar 15 16:31:47 GMT 2024


Le 10/03/2024 à 22:31, Harald Anlauf a écrit :
> Dear all,
> 
> after playing for some time with NAG and Intel, and an off-list
> discussion with Jerry, I am getting more and more convinced that
> simpler runtime error messages (also simpler to parse by a human)
> are superior to awkward solutions.  This is also what Intel does:
> use only the name of the array (component) in the message whose
> indices are out of bounds.
> 
> (NAG's solution appears also inconsistent for nested derived types.)
> 
> So no x%z, or x%_data, etc. in runtime error messages any more.
>
That's a pity.  What about providing the root variable and the failing 
component only?

... dimension 1 of array component 'z...%x' above array bound ...

The data reference doesn't look great, but it provides valuable (in my 
opinion) information.

> Please give it a spin...
> 
> Regtested on x86_64-pc-linux-gnu.  OK for mainline?
> 
> Thanks,
> Harald
> 
> 
> On 1/30/24 11:46, Mikael Morin wrote:
>> Le 30/01/2024 à 11:38, Mikael Morin a écrit :
>>>
>>> Another (easier) way to clarify the data reference would be rephrasing
>>> the message so that the array part is separate from the scalar part,
>>> like so (there are too many 'of', but I lack inspiration):
>>> Index '0' of dimension 1 of component 'zz' of element from 'x1%vv'
>>> below lower bound of 1
>>>
>> This has the same number of 'of' but sounds better maybe:
>> Out of bounds accessing component 'zz' of element from 'x1%yy': index
>> '0' of dimension 1 below lower bound of 1
>>



More information about the Fortran mailing list