Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ucbvax!WATSON.IBM.COM!jbs From: jbs@WATSON.IBM.COM Newsgroups: comp.arch Subject: Re: IEEE arithmetic (Goldberg paper) Message-ID: <9106190124.AA27410@ucbvax.Berkeley.EDU> Date: 19 Jun 91 01:12:20 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 35 I said: >I think that if a (legal) program behaves differently when compiled with >and without optimization that then the compiler is broken. Perhaps you >disagree. Malcolm said: B = 5.0 IF ( ( B .GT. 3.0 ) .OR. MYTEST(A) ) PRINT some diagnotic messages LOGICAL FUNCTION MYTEST(X) REAL X MYTEST = some boolean work PRINT a few diagnostics on the screen RETURN END I modified this to: LOGICAL*4 MYTEST B = 5.0 IF ( ( B .GT. 3.0 ) .OR. MYTEST(B) )THEN WRITE(6,*)' MAIN' ENDIF END LOGICAL FUNCTION MYTEST(X) REAL X WRITE(6,*)' MYTEST' MYTEST = .TRUE. RETURN END I checked the behavior with the IBM VS Fortran and Xlf compi- lers. In both cases the behavior was not changed by optimization. The behavior differs between the two compilers but that is a different is- sue. So this example will not convince me that I'm wrong. (Actually I later softened my original statement to say it is undesirable for optimization to affect a program's behavior.) James B. Shearer