Greg Lindahl wrote:
>>>As an aside, there are ISV codes which do things like:
>>>
>>>call foo(a(-1000),...)
>>>
>>>where a(-1000) isn't in bounds, but this argument isn't used in
>>>foo(). Needless to say, the ISV isn't going to fix the code.
>>
>>Can any compiler handle this situation? Seems to me that a(-1000)
>>simply has to be executed before the foo() starts executing.
> If your ABI is pass-by-reference, then yes, it can cover up for this
> error by not dereferencing any argument until it's actually used. In
> practice, this is most compilers. We ended up with a switch to control
> this feature, because we didn't want to reduce code motion and
> if-conversion.
Indeed. This just harms interprocedural optimization (that's why Greg's
compiler wants to hide it behind a compile time flag).
Straight "pass-by-reference" would "cure" this (if the reference inside
the subroutine is valid, of course).
Cheers,
--
Toon Moene - e-mail: [log in to unmask] - phone: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
A maintainer of GNU Fortran 95: http://gcc.gnu.org/fortran/
My next laptop will have a crank
|