-fargument-noalias-global question

Toon Moene toon@moene.org
Sat Jan 3 19:37:00 GMT 2009


Toon Moene wrote:

> Richard Guenther wrote:

>> consider
>>
>> void bar()
>> {
>>   int i;
>>   p = &i;
>>   foo (&i);
>> }
>>
>> does that call to foo invoke undefined behavior if built with
>> -fargument-noalias-global?
> 
> It shouldn't, as 'int i' isn't global.

Ugh, on second thoughts, this isn't possible in Fortran, so I should 
have been more careful in my analysis.

-fargument-noalias-global is supposed to mean:

Argument pointers (as used by the Fortran front end to implement 
Fortran's argument association) cannot point to global memory (like COMMON).

Of course, you're still able to say:

       SUBROUTINE AAP(P)
       P = 5.0
       END

and it will change something outside subroutine AAP (namely, the actual 
argument associated with P), but (the argument pointer of) P isn't 
supposed to (as in: this a restriction on the programmer) point to 
global memory (in the Fortran sense, i.e., COMMON).

Bah, this gets really ugly if you try to give it meaning outside Fortran.

Hope this helps,

-- 
Toon Moene - e-mail: toon@moene.org (*NEW*) - phone: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
At home: http://moene.org/~toon/
Progress of GNU Fortran: http://gcc.gnu.org/gcc-4.4/changes.html



More information about the Fortran mailing list