Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!elroy.jpl.nasa.gov!usc!apple!well!rchrd From: rchrd@well.sf.ca.us (Richard Friedman) Newsgroups: comp.lang.fortran Subject: Re: Questions about IF Message-ID: <25663@well.sf.ca.us> Date: 25 Jun 91 03:04:31 GMT References: Lines: 21 Another compiler-dependent problem with IF statements has to do with optimizations. Supposing the IF is within a loop and the compiler has smartly removed loop independent computations outside the loop, but some of the items in the IF expression should not be computed if earlier expressions are false because they will cause out of bounds array references: IF(SW1 .and. BAR(I+N)-BAR(I) .eq. 0)... Suppose I and N are not defined if SW1 is false (say its some sort of processing option). If the IF were in a loop, the compiler might want to precompute the BAR()-BAR(), or atleast maybe just prefetch them. This could generate referencing errors if SW1 is false. And, it could be order dependent (left-right r/t right-left), which raises portability issues. Gotta be careful outthere. -- /\=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=/\ \/Richard Friedman (415)540-5216 | rchrd@well.sf.ca.us \/ /\Pacific-Sierra Rsrch (Berkeley) | or well!rchrd@apple.com /\ \/=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\/