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

            Bug ID: 109348
           Summary: Pointer initialization fails for target with
                    references
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pault at gcc dot gnu.org
  Target Milestone: ---

As posted by Peter Klausler on clf

complex, save, target :: a(4) = [(1.,0.),(2.,0.),(3.,0.),(4.,0)]
real, pointer :: p(:) => a(1:3:2)%re
print *, p
end

gfc doesn't even attempt to initialise the pointer. Malcolm Cohen and Steve
Lionel both agree that this is valid F2018.

complex, save, target :: a(4) = [(1.,0.),(2.,0.),(3.,0.),(4.,0)]
real, pointer :: p(:)
p(1:) => a(1:3:2)%re
print *, p
end

Works, as long as an lbound is provided on the lhs. nagfor behaves similarly,
whereas ifort does not even accept this version. 

Cheers

Paul

Reply via email to