Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bionet!ames!sun-barr!newstop!sun!chiba!khb From: khb%chiba@Sun.COM (chiba) Newsgroups: comp.lang.fortran Subject: Re: FORTRAN array aliasing -- potential problems? Message-ID: <118815@sun.Eng.Sun.COM> Date: 1 Aug 89 04:13:47 GMT References: <8907311910.AA15243@robalo.nyu.edu> Sender: news@sun.Eng.Sun.COM Reply-To: khb@sun.UUCP (chiba) Organization: Sun Microsystems, Mountain View Lines: 46 In article <8907311910.AA15243@robalo.nyu.edu> mckenney@ROBALO.NYU.EDU (Alan McKenney) writes: > > I am considering a situation in which I would call a FORTRAN >subroutine which has several dummy argument arrays using the >same actual array. Example: >.... details deleted... > My question then: are there FORTRAN implementations, either >existing or which one could make an argument for using, under which >such code would break? I used to support a collection of codes for kalman filtering. After porting it to at least 30 different vendors machines we were convienced that call rank1(a,a,...) worked just fine, standard notwithstanding. Then we got to the CDC7600. With no optimization, it worked (but one also automagically got tons of debugging stuff put in). With even minimal optimization, it broke. turned out that between code motion and instruction scheduling, about 100 lines of code were rewritten by the compiler so that line 100 was executed just after line 1. This broke the code, thanks to the implicit aliasing. As features from the 66xx, Cydra5 and Trace/xxx and other machines which really benefit from code motion+instruction scheduling become popular (e.g. SPARC in current and proposed incarnations) I suspect that over time your code will begin to break more often. Stick to the standard. If you must violate it, violate it with something that smacks of good programming (e.g. malloc calls, record variables, etc.). cheers Keith H. Bierman |*My thoughts are my own. Only my work belongs to Sun* It's Not My Fault | Marketing Technical Specialist ! kbierman@sun.com I Voted for Bill & | Languages and Performance Tools. Opus (* strange as it may seem, I do more engineering now *)