Am 28.01.24 um 22:43 schrieb Steve Kargl:
On Sun, Jan 28, 2024 at 08:56:24PM +0100, Harald Anlauf wrote:
Am 28.01.24 um 12:39 schrieb Mikael Morin:
Le 24/01/2024 à 22:39, Harald Anlauf a écrit :
Dear all,
this patch is actually only a followup fix to generate the proper name
of an array reference in derived-type components for the runtime error
message generated for the bounds-checking code. Without the proper
part ref, not only a user may get confused: I was, too...
The testcase is compile-only, as it is only important to check the
strings used in the error messages.
Regtested on x86_64-pc-linux-gnu. OK for mainline?
the change proper looks good, and is an improvement. But I'm a little
concerned by the production of references like in the test x1%vv%z which
could be confusing and is strictly speaking invalid fortran (multiple
non-scalar components). Did you consider generating x1%vv(?,?)%zz or
x1%vv(...)%z or similar?
yes, that seems very reasonable, given that this is what NAG does.
We also have spurious %_data in some error messages that I'll try
to get rid off.
I haven't looked at the patch, but sometimes (if not always) things
like _data are marked with attr.artificial. You might see if this
will help with suppressing spurious messages.
I was talking about the generated format strings of runtime error
messages.
program p
implicit none
type t
real :: zzz(10) = 42
end type t
class(t), allocatable :: xx(:)
integer :: j
j = 0
allocate (t :: xx(1))
print *, xx(1)% zzz(j)
end
This is generating the following error at runtime since at least gcc-7:
Fortran runtime error: Index '0' of dimension 1 of array 'xx%_data%zzz'
below lower bound of 1
I believe you were recalling bogus warnings at compile time.
There are no warnings here, and there shouldn't.