https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87000
--- Comment #3 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Fri, Aug 17, 2018 at 06:34:01PM +0000, gavin.keith.ridley at gmail dot com wrote: > OK, I see, thank you. I believe you're right on that. When I > tried to make this example, I cut out an important part that > seems to cause the difference between > gcc compiler versions. This code: > > program asdf > use iso_fortran_env > implicit none > real(real64), dimension(:), allocatable :: arr > allocate(arr(-5:10)) > print *, 'lbound = ', lbound(arr) > print *, 'ubound = ', ubound(arr) > call boundprinter(arr) > > contains > subroutine boundprinter(x) > class(*), intent(in), dimension(:) :: x > print *, 'lbound = ', lbound(x) > print *, 'ubound = ', ubound(x) > endsubroutine boundprinter > endprogram asdf > > Gives the difference I'm looking to illustrate. Insteady of > specifying the type of the array, this instead has the polymorphic > class(*) which gives lbound=-5 on gcc 4.9.3 but gives lbound=1 > on gcc 7.3.1. Which gcc is correct? Hmm, I don't use Fortran's OOP features such as CLASS(*), so I don't know if there are different rules for CLASS(*) dummy arguments. I would presume the F2003, 5.1.2.5.2, would still hold in F2008 and later. Just checked. F2008, 5.3.8.3, appears to be indentical to F2003. So, I suspect that gcc 7.3.1 is correct. I'll that or unlimited polymorphic variables (CLASS(*)) first appeared in gfortran in 4.8.x, so the older version like had a bug.