https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87336
Bug ID: 87336 Summary: [8/9 regression] wrong output for pointer dummy assiocated to target actual argument Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: juergen.reuter at desy dot de Target Milestone: --- The following code is expected to give: a [before] = 2 3 4 arr = 2 3 4 bounds = 2 4 arr2= 200 200 200 a [after] = 200 200 200 (and did so with gfortran 5.4), but gives with gfortran 8 and 9: a [before] = 2 3 4 arr = 2 2 2 bounds = 2 4 arr2= 200 200 200 a [after] = 200 3 4 The code is: program main implicit none integer, target :: a( 2:4 ) a = [2,3,4] print *, "a [before] = ", a call show( a ) print *, "a [after] = ", a contains subroutine show( arr ) integer, pointer, intent(in) :: arr(:) print *, "arr = ", arr print *, "bounds = ", lbound(arr), ubound(arr) arr(:) = 200 print *, "arr2= ", arr end subroutine show end program Discussed on c.l.f. Sep. 16, 2018.