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

--- Comment #7 from janus at gcc dot gnu.org ---
(In reply to Walter Spector from comment #6)
> Your test case in Comment #5 is fine - because it is not attempting to
> initialize the pointer at compile time.  Initializing a pointer at compile
> time is a F2008 feature.

I know. But in the end it's just a pointer assignment as well. Why should the
rules be so much different?

Can you possibly point me to the relevant place in the F08 standard, which
allows comment #5, but forbids comment #0?


> If I feed my original test case into ifort (v17), I get:
> 
> /tmp/wws> ifort ptr2.f90
> ptr2.f90(10): error #8813: The target must have the TARGET attribute.  
> [DATA]
>   integer, pointer :: idata => data%i
> -------------------------------^

Well, ok. But just because ifort rejects it, it doesn't necessarily mean that
it's valid ;)

What does ifort say on the example in comment #5? And what about this example,
which is again similar to your original case:

program p
  implicit none

  type data_t
    integer :: i = 9
  end type

  type(data_t), target :: d
  type(data_t), pointer :: dp => d
!   integer, pointer :: ip => d%i  ! certainly legal
  integer, pointer :: ip => dp%i  ! also legal!?!

  print *,ip
end


gfortran again throws an ICE on this, but if I instead use the commented-out
line, it works fine.

Reply via email to