Hello,
I think I may have found a bug in nvfortran 24.7-0 for the initialization of derived data types including pointers.
type :: FooType
real :: rbar = -999.
character(len=10), pointer :: pbar => NULL()
integer, dimension(17) :: ibar = -999
end type FooType
type(FooType), target :: foo = &
FooType( &
! pbar = NULL(), &
ibar = 0, &
rbar = 1 &
)
END
gives me two errors:
NVFORTRAN-S-0067-Too many data constants in initialization statement (t.f90: 7)
NVFORTRAN-S-0066-Too few data constants in initialization statement (t.f90: 7)
which is kind of contradictory :-)
I can get rid of the “Too many” by reducing the dimension of ibar to 16, for example, which is odd, but this seems to be only a cascade effect. The general problem instead appears to be the default value for the pointer pbar. If activating the pbar = NULL() in the constructor initialization, everything is well, or if the default value for pbar is omitted, also no error is produced. You can play around with the code a little bit, to trigger the error(s) or not by small changes, but I think even a pointer should be initializable to a default, and overridden in the constructor only if needed.
Please bear some patience with me in case I misinterprete the FORTRAN standard in this regard.
Thanks for your support.
Regards,
Manuel