This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/38863] WHERE with multiple elemental defined assignments gives wrong answer



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]