Article View: comp.lang.misc
Article #2249Re: C vs. FORTRAN aliasing
From: Jim Giles
Date: Wed, 28 Nov 1990 21:15
Date: Wed, 28 Nov 1990 21:15
24 lines
1396 bytes
1396 bytes
From article <15704.274a7509@levels.sait.edu.au>, by ccml@levels.sait.edu.au: < In article <RANG.90Nov18160113@nexus.cs.wisc.edu>, 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
Technical Details
Message-ID:
<7224@lanl.gov>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!lanl!jlgReferences:
<15704.274a7509@levels.sait.edu.au>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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