🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #1805

Re: Aggressive optimization

#1805
From: Sean Fagan
Date: Wed, 24 Oct 1990 06:01
41 lines
2315 bytes
In article <25336:Oct1823:13:3990@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes:
>> >Unsafe transformations and other optimizer bugs. As in sun% cc -O4. Not
>> >to pick on your compiler, which is otherwise rather nice.

The CDC Cyber 170 FORTRAN compiler has 3 levels of optimization:  O1, O2,
and O3.  O1 was, essentially, no optimization (there may have bene a
differenc between no O<num> and O1, but I don't think so); O2 was, basicly,
full optimization.  The only difference between O2 and O3 was that O3 would
take advantage of delayed loads for array traversals.  For example:

	REAL foobar(35)
	REAL sum
	sum = 0.
	DO 10 i=0,35,1
		sum = sum + foobar(i)
		foobar(i) = foobar(i-1)*sum
 10	CONTINUE

With O2, the loop would be compiled as you expected.  With O3, however, near
the end of the loop would be a load for the next element in foobar.  Note
that, at the end of the loop, this would be accessing an element not of
foobar.  If foobar happened to be placed at the end of your memory segment,
this would cause a runtime error (fatal).

On the other hand, on the top-of-the-line machines, this extra optimization
could spell the difference between 20 hours and 15 hours, which is quite a
bit.

I don't consider this buggy, since the documentation clearly told you what
it would do, and what to expect, and you could always avoid it if you didn't
want to take that chance.

I'm not saying the Sun compiler is like that, but it is a possibility...

-- 
-----------------+
Sean Eric Fagan  | "*Never* knock on Death's door:  ring the bell and 
seanf@sco.COM    |   run away!  Death hates that!"
uunet!sco!seanf  |     -- Dr. Mike Stratford (Matt Frewer, "Doctor, Doctor")
(408) 458-1422   | Any opinions expressed are my own, not my employers'.
Technical Details
Message-ID: <8371@scolex.sco.COM>
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!sco!seanf
References: <1493@exodus.Eng.Sun.COM> <20683:Oct1819:44:1490@kramden.acf.nyu.edu> <1990Oct18.212844.14728@murdoch.acc.Virginia.EDU> <25336:Oct1823:13:3990@kramden.acf.nyu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!telly!attcan!uunet!sco!seanf
From: seanf@sco.COM (Sean Fagan)
Newsgroups: comp.lang.misc
Subject: Re: Aggressive optimization
Message-ID: <8371@scolex.sco.COM>
Date: 24 Oct 90 06:01:57 GMT
References: <1493@exodus.Eng.Sun.COM> <20683:Oct1819:44:1490@kramden.acf.nyu.edu> <1990Oct18.212844.14728@murdoch.acc.Virginia.EDU> <25336:Oct1823:13:3990@kramden.acf.nyu.edu>
Sender: news@sco.COM
Reply-To: seanf (Sean Fagan)
Organization: The Santa Cruz Operation, Inc.
Lines: 41