https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102369
Bug ID: 102369
Summary: VALUE attribute for arrays not allowed
Product: gcc
Version: 11.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: longb at cray dot com
Target Milestone: ---
> cat test.f90
module mymod
contains
pure real function myfunc(x)
integer, value, dimension(:), intent(in) :: x
myfunc = x(1)
end function myfunc
end module mymod
program main
use mymod
implicit none
integer, parameter :: sz = 10
integer, dimension(sz) :: foo
foo = 42
print *, myfunc(foo)
end program main
> ifort test.f90
> ./a.out
42.00000
> gfortran test.f90
test.f90:4:14:
4 | integer, value, dimension(:), intent(in) :: x
| 1
Error: VALUE attribute conflicts with DIMENSION attribute at (1)
test.f90:3:27:
3 | pure real function myfunc(x)
| 1
Error: Dummy procedure 'x' of PURE procedure at (1) must also be PURE
test.f90:5:9:
5 | myfunc = x(1)
| 1
Error: Reference to impure function 'x' at (1) within a PURE procedure
test.f90:9:5:
9 | use mymod
| 1
Fatal Error: Cannot open module file 'mymod.mod' for reading at (1): No such
file or directory
compilation terminated.
> gfortran --version
GNU Fortran (GCC) 11.2.0 20210728 (Cray Inc.)
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.