Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!lanl!lambda!jlg From: jlg@lambda.UUCP (Jim Giles) Newsgroups: comp.lang.misc Subject: Re: Detection of aliasses (was: Arrays in languages, was:...) Message-ID: <14257@lambda.UUCP> Date: 2 Mar 90 19:24:56 GMT References: <8860@boring.cwi.nl> Lines: 26 From article <8860@boring.cwi.nl>, by dik@cwi.nl (Dik T. Winter): > [...] However, my opinion is that any attempt to detect aliassing in > a Fortran routine invalidates the code. [...] Oh yes, absolutely. If, by "invalidates", you mean that the code becomes non-standard: you're absolutely correct. The only way to detect aliasing (unless the compiler does it for you automatically) is to rely on extra- linguistic aids - loc() functions for example. Such aids can not be written in Fortran (so they are clearly not "standard Fortran"). Although these extra-linguistic tools aren't Fortran - _calling_them_ is not against the standard. So, using them to detect aliasing is a quite legitimate use of non-Fortran subroutine libraries. Of course, any such use will not be portable to an environment which doesn't support the extra-linguistic tools that you rely on. However, in the case you gave (namely: two input parameters which are either disjoint or identical), the detection of aliasing requires a simple compare of the loc() of each parameter. Not many environments fail to provide a loc() function (or, at least, the possibility of writing one yourself in assembly). One last point: if your procedure interface is implemented as call by value/result, aliasing is not possible. So the detection mechanism would have to be modified so that is never claimed a match (or, take the detection code out when you port to a value/result environment). J. Giles