Regression or Feature?

Tilo Schwarz tilo@tilo-schwarz.de
Fri Apr 26 19:33:00 GMT 2013


Hi,

I wasn't sure about this so I didn't open a PR yet.

For the program below I get:

% gfortran-4.6 prg_ptr_array.f08

% gfortran-4.7 prg_ptr_array.f08

% ~/Unix/opt/gcc-4.8/usr/local/bin/gfortran prg_ptr_array.f08
prg_ptr_array.f08:20.25:

     if (any([a%i, b%i] /= arr%p%i)) call abort
                          1
Error: Component to the right of a part reference with nonzero rank must  
not have the POINTER attribute at (1)

% ~/Unix/opt/gcc-4.9/usr/local/bin/gfortran prg_ptr_array.f08
prg_ptr_array.f08:20.25:

     if (any([a%i, b%i] /= arr%p%i)) call abort
                          1
Error: Component to the right of a part reference with nonzero rank must  
not have the POINTER attribute at (1)

% ~/Unix/opt/gcc-4.8/usr/local/bin/gfortran --version | grep pre
GNU Fortran (GCC) 4.8.1 20130426 (prerelease)

% ~/Unix/opt/gcc-4.9/usr/local/bin/gfortran --version | grep exp
GNU Fortran (GCC) 4.9.0 20130426 (experimental)


I would expect the behaviour of gfortran 4.6/4.7.
a.out runs without error for those two compiler versions.


--------------------------------------------------------
program ptr_array

     type t
         integer i
     end type t

     type tp
         class(t), pointer :: p
     end type tp

     type(t), target :: a, b
     type(tp) arr(2)

     a%i = 1
     b%i = 2

     arr(1)%p => a
     arr(2)%p => b

     if (any([a%i, b%i] /= arr%p%i)) call abort

end program ptr_array
--------------------------------------------------------

Regards,
	Tilo



More information about the Fortran mailing list