This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]