This is the mail archive of the gcc-patches@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]

Re: [patch] Fix aliasing problem with fortran


Hello,

> 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()
> contains
> 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[5];
> ...
>     int4[3] * p;
>     p = (int4[3] *) &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?

Zdenek


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