I’m having an issue with lbound. Consider the following example code:
program main use ISO_FORTRAN_ENV, only : INT32 implicit none type :: mytype integer, dimension(:), allocatable :: a end type mytype type(mytype) :: t allocate(t%a(-25:400)) write(*,*) lbound(t%a,KIND=INT32) ! -- Bugged end program main
I get the following compiler error with 15.5 and 14.3:
km-gs3% pgfortran --version pgfortran 15.5-0 64-bit target on x86-64 Linux -tp piledriver The Portland Group - PGI Compilers and Tools Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. km-gs3% pgfortran test_bounds.f90 /tmp/pgfortranpfmdTLpQqW1D.o: In function `main': /home/project-chaud106/Testing/./test_bounds.f90:10: undefined reference to `pghpf_lbounda4'
Seems like a compiler bug to me. The issue only occurs when the array is a component of a derived data type. It’s also present for ubound.
Of course, I can simply use int to cast lbound as a kind of my choice:
write(*,*) int(lbound(t%a),KIND=INT32) ! -- Not bugged
But it would be nice if the bounds worked as expected.