This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

Re: [Fortran] Improved dependency analysis of pointer variables


Finally, the third change is that a pointer variable "p" and another
variable "v" can not reference the same object, if the base type of
"p" is not the same as the base type of "v".  To demonstrate this
consider the example code below extracted from the polyhedron benchmark
capacita.f90:


integer, private, pointer, dimension(:,:) :: Grid real, allocatable, dimension(:,:) :: Y

    where (Grid == 0)
      Y = 0
    end where

Sorry for the possible very naive question, but doesn't that interfere with equivalences, such as:


$ cat a.f90
  integer :: i(5)
  real(4) :: x(5)
  equivalence(x,i)

  i = (/ 1, 0, 3, 5, 0 /)
  where (i == 0)
    x = -42.
  end where
  print *, i
  end
$ gfortran a.f90 && ./a.out
           1 -1037565952           3           5 -1037565952

(this is with the current mainline gfortran). I know this example is not valid from the standard point of view, but it's a construct that is used a lot (although usually in the other way around, setting fp values by equivalencing them to integers), including our testcase and tons of already available and widely used code.

FX


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