This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/38863] WHERE with multiple elemental defined assignments gives wrong answer
- From: "pault at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Apr 2009 17:03:22 -0000
- Subject: [Bug fortran/38863] WHERE with multiple elemental defined assignments gives wrong answer
- References: <bug-38863-15620@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #16 from pault at gcc dot gnu dot org 2009-04-30 17:03 -------
module m
type t
integer :: i,j
end type t
interface assignment (=)
module procedure i_to_t
end interface
contains
elemental subroutine i_to_t (p, q)
type(t), intent(out) :: p
integer, intent(in) :: q
p%i = q
end subroutine
end module
use m
type(t), target :: a(3)
type(t), target :: b(3)
type(t), dimension(:), pointer :: p
a%i = 1
a%j = 2
b%i = 3
b%j = 4
p => b
a = p%i
print *, a%j
end
Also shows the fault, so it's not just restricted to WHERE assignments. It's
interesting to note that in this case, the dependency is due to the possibility
of aliasing and is, in fact, not present.
I can see easily how to fix it for the case here but have not quite clocked how
to do comment#1 yet.
Paul
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38863