This is the mail archive of the
mailing list for the GCC project.
Re: [patch] Fix aliasing problem with fortran
> On Monday 16 May 2005 20:32, Zdenek Dvorak wrote:
> > * trans-types.c (gfc_array_range_type): New variable.
> > (gfc_init_types): Initialize gfc_array_range_type.
> > (gfc_get_array_type_bounds): Use gfc_array_range_type.
> I don't believe this is sufficient. For example:
> program prog
> integer, dimension(5) :: a
> a(1) = 1;
> call foo(a)
> if (a(1) .ne. 0) call abort()
> subroutine foo(p)
> integer p(3)
> p(1) = 0;
> end subroutine
> end program
> Both with and without your patch this compiles to (from the .gimple dump):
> int4 a;
> int4 * p;
> p = (int4 *) &a;
> accesses to both a and *p
it this a correct program? I don't know fortran standard -- is it
valid to use an array with different dimensions in this way?