Article View: comp.lang.misc
Article #2205Re: C vs. FORTRAN aliasing
From: Anton Rang
Date: Wed, 21 Nov 1990 17:59
Date: Wed, 21 Nov 1990 17:59
28 lines
1649 bytes
1649 bytes
In article <15704.274a7509@levels.sait.edu.au> ccml@levels.sait.edu.au writes: >I wrote: >> SUBROUTINE BLAH(X,Y) >> INTEGER X,Y >> X = 3 >> Y = 2 >> IF (A(X) .EQ. 0) ... >> >> [edited down] >> 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)'! If there was, then the program is erroneous (not legal FORTRAN, I'm not sure if 'erroneous' is the term ANSI uses in the FORTRAN spec). In a legal FORTRAN program, X and Y can never be aliased (strictly speaking, program execution can not depend on whether X and Y are aliased or not). Anton +---------------------------+------------------+-------------+ | Anton Rang (grad student) | rang@cs.wisc.edu | UW--Madison | +---------------------------+------------------+-------------+
Technical Details
Message-ID:
<RANG.90Nov21115939@nexus.cs.wisc.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!sdd.hp.com!caen!math.lsa.umich.edu!sharkey!msuinfo!rangReferences:
<RANG.90Nov18160113@nexus.cs.wisc.edu> <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!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!sdd.hp.com!caen!math.lsa.umich.edu!sharkey!msuinfo!rang From: rang@cs.wisc.edu (Anton Rang) Newsgroups: comp.lang.misc Subject: Re: C vs. FORTRAN aliasing Message-ID: <RANG.90Nov21115939@nexus.cs.wisc.edu> Date: 21 Nov 90 17:59:39 GMT References: <RANG.90Nov18160113@nexus.cs.wisc.edu> <15704.274a7509@levels.sait.edu.au> Sender: news@msuinfo.cl.msu.edu Organization: UW-Madison CS department Lines: 24 In-Reply-To: ccml@levels.sait.edu.au's message of 21 Nov 90 12:37:29 GMT