https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89925
Bug ID: 89925 Summary: [8,9 Regression] Wrong array bounds from ALLOCATE with MOLD Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: neil.n.carlson at gmail dot com Target Milestone: --- My colleague passed this example on to me to report. This runs correctly with a 8.2.1 and 9 from Sept, but fails with the current 8 and 9 versions. I believe it may be a result of the same bad commit(s) that caused PR89174 which I reported. This example and the one from the other PR originate from the same code. module arraytest use, intrinsic :: iso_fortran_env contains subroutine allocarray(moldarray) real(real64), contiguous, intent(in) :: moldarray(0:,0:,0:) real(real64), allocatable :: array(:,:,:) integer :: lb1(3),lb2(3) allocate(array,mold=moldarray) lb1 = lbound(moldarray) lb2 = lbound(array) if (lb1(1).ne.lb2(1)) write(*,*) "ERROR" end subroutine end module program test use arraytest real(real64), allocatable, target :: array(:,:,:) allocate(array(5,5,5)) call allocarray(array) end program