[Bug fortran/77632] New: Pointer initialisation does not quite work

arjen.markus895 at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Sep 18 13:15:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77632

            Bug ID: 77632
           Summary: Pointer initialisation does not quite work
           Product: gcc
           Version: 5.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arjen.markus895 at gmail dot com
  Target Milestone: ---

The Fortran 2008 standard allows pointer variables to be initialised as:

real, dimension(100), target :: array
real, dimension(:), pointer :: parray => array

While the syntax is accepted, the result is not as expected. The following
program demonstrates this:

! test_pointer_init.f90 --
!     It seems pointer initialisation is not working correctly?
!
program test_pointer_init
    implicit none

    real, dimension(100), target  :: array
    real, dimension(:), pointer   :: alternative => array

    ! This prints "F" whereas I expect "T"

    write( *, '(a,l)'      ) '    Associated: ', associated(alternative,array)

end program test_pointer_init


More information about the Gcc-bugs mailing list