[Bug fortran/85537] [7/8/9 Regression] Invalid memory reference at runtime when calling subroutine through procedure pointer
janus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun May 20 20:14:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85537
--- Comment #6 from janus at gcc dot gnu.org ---
(In reply to janus from comment #5)
> However I don't see any failures with this variant:
Sorry, I was a bit too quick in submitting this. It's really not a good
example, since it's missing an "implicit none", so "bar_impl" supposedly gets
its own private version of "a".
The following variant fails again in the same way as the original test case:
program main
implicit none
integer :: a
call foo()
contains
subroutine foo()
abstract interface
subroutine ibar()
end subroutine
end interface
procedure(ibar), pointer :: bar_ptr => bar_impl
a = 0
call bar_impl()
call bar_ptr()
end subroutine
subroutine bar_impl()
write (*,*) "foo"
a = a + 1
end subroutine
end program
I don't quite understand what's going on. Apparently the reference to the
variable 'a' somehow goes wrong. But I don't see how the procedure pointer
makes a difference here.
More information about the Gcc-bugs
mailing list