Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!lanl!jlg From: jlg@lanl.gov (Jim Giles) Newsgroups: comp.lang.misc Subject: Re: C vs. FORTRAN aliasing Message-ID: <7224@lanl.gov> Date: 28 Nov 90 21:15:27 GMT References: <15704.274a7509@levels.sait.edu.au> Organization: Los Alamos Natl Lab, Los Alamos, N.M. Lines: 24 From article <15704.274a7509@levels.sait.edu.au>, by ccml@levels.sait.edu.au: < In article , rang@cs.wisc.edu (Anton Rang) writes: <> [...] <> SUBROUTINE BLAH(X,Y) <> INTEGER X,Y <> X = 3 <> Y = 2 <> IF (A(X) .EQ. 0) ... <> [...] <> A compiler for FORTRAN can optimize the test to be A(3) since it <> knows that the assignment to Y can never change X. A compiler for C, <> in the absence of interprocedural aliasing information, cannot do the <> same. < Assuming that there was no 'EQUIVALENCE (a,b)' in the routine < which does the 'CALL BLAH(a,b)'! Yes, that is the assumption being made. It is a valid assumption. An EQUIVALENCE (a,b) in the context you mention is _illegal_, so the compiler is perfectly free to assume it didn't happen. Now, it _is_ true that most Fortran implementations don't actually test to make sure that the illegal aliasing didn't occur - but _many_ available Fortran analysis tools can discover these for you. J. Giles