This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/32881] New: PURE attribute escapes from contained procedure
- From: "jb at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Jul 2007 16:13:50 -0000
- Subject: [Bug fortran/32881] New: PURE attribute escapes from contained procedure
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following testcase is AFAICT legal:
subroutine foo ()
integer, pointer :: p => NULL()
contains
pure function bar (a)
integer, intent(in) :: a
integer :: bar
bar = a
end function bar
end subroutine foo
gfortran refuses to compile it, complaining
pure-escape.f90:2.23:
integer, pointer :: p => NULL()
1
Error: Bad pointer object in PURE procedure at (1)
Remove the pure attribute from the contained function "bar", or the "=> NULL()"
initialization of the pointer, and it compiles. Both ifort and the Lahey online
checker accept the code, and I can't really see how the standard could say
otherwise.
My guess is that gfortran thinks foo is also pure, and hence initializing p
means that it's saved and thus it complains.
--
Summary: PURE attribute escapes from contained procedure
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jb at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32881