proposal for compilation unil wide alias analyis

Dale Johannesen dalej@apple.com
Mon Jun 28 17:25:00 GMT 2004


On Jun 28, 2004, at 4:58 AM, Paul Brook wrote:
> On Monday 28 June 2004 12:44, Mircea Namolaru wrote:
>> We started to implement IPA constant propagation
>> (see http://gcc.gnu.org/ml/gcc/2004-06/msg00518.html) and also look 
>> into
>> some related IPA alias analysis issues.
>>
>> As we understand it, your proposal targets static variables only.
>> Extending
>> the analysis to reference formal arguments may detect aliasing 
>> introduced
>> by
>> parameter passing (in Fortran this is the only way two variables can
>> alias).
>
> No they can't. Aliasing of variables through procedure arguments is 
> prohibited
> by the standard.
>
> For example the following program is illegal:
>
> subroutine foo (a, b)
>   integer a, b
>   ! This invokes undefined behaviour if the same actual argument
>   ! is passed for a and b
>   a = 1
>   print *, b
> end subroutine
>
> program illegal
>   integer i
>   call foo (i, i)
> end program

This property is abstracted as -fargument-noalias-global (set by 
Fortran),
which aliasing code can look at.



More information about the Gcc mailing list