Optimization considered harmful

John Stanley stanley at phoenix.com
Thu Nov 1 03:11:16 AEST 1990


bks at alfa.berkeley.edu (Brad Sherman) writes:
> We guess that this is because the compiler "runs out of registers."
> (Is that excessively anthropomorphic?)

   No, but "runs out of registers and spits out stinky assembly to get
back at the programmer who asked for too many" would be. 8-0
> 
> Now, which of the following lessons should be drawn from this event:
> 	1) Don't use "register."
> 	2) Don't use optimizers (or in this case be sure to disable optimizer).

   The TC manual tells me that using the 'register optimizer' is
dangerous. The compiler may be unable to detect certain usages and reuse
a register incorrectly. This may be a similar problem to what you have.

   I haven't had a chance to try your code with TC, but will and let you
know if I find anything interesting.



"Arinth is a beautiful planet." "Oh, have you been there?"
  "Yes, but not yet." The Doctor. (TB)



More information about the Comp.lang.c mailing list