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

G. Steinmetz <gs...@t-online.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code
             Target|                            |x86_64-pc-linux-gnu

--- Comment #1 from G. Steinmetz <gs...@t-online.de> ---

This expanded variant results in an error (an indirect hint) :

$ cat zz2.f90
program p
   integer, target :: a(3) = [7, 8, 9]
   integer, pointer :: x => a(n())
   print *, x
contains
   pure integer function n()
      n = 2
   end
end

$ gfortran-12-20210801 -c zz2.f90
zz2.f90:6:3:

    6 |    pure integer function n()
      |   1
Error: INTERNAL-PROC procedure at (1) is already declared as EXTERNAL-PROC
procedure



And for completeness, a correct version could look like this :

$ cat zz3.f90
program p
   integer, target :: a(3) = [7, 8, 9]
   integer, pointer :: x
   x => a(n())
   print *, x
contains
   pure integer function n()
      n = 2
   end
end

$ gfortran-12-20210801 zz3.f90 && ./a.out
           8
$

Reply via email to