Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!killer!chasm From: chasm@killer.UUCP (Charles Marslett) Newsgroups: comp.lang.c Subject: Re: Optimization (was Re: volatile) Message-ID: <3938@killer.UUCP> Date: 27 Apr 88 05:20:25 GMT References: <13074@brl-adm.ARPA> Organization: The Unix(R) Connection, Dallas, Texas Lines: 29 Summary: Say What? In article <13074@brl-adm.ARPA>, dsill@NSWC-OAS.arpa (Dave Sill) writes: > Terry Lambert writes: > >Basically, if it works without -O, it should work with -O, regardless of what > >the compiler writer's optimization does to achieve its goal. If this makes > >writing compilers harder, so what? > > This bears repeating. There should be no circumstances under which > the semantics of the language are changed by a flag to the compiler. Actually, I have written code the broke with optimization turned on on every machine I've found with a Unix-derived C compiler (and at least two that are not Unix-derived). Memory mapped I/O drivers almost always blow up when you have sequences like port->data = 0; port->data = 0; port->data = 0; port->data = 2; So are we to say that no one has yet written a C compiler? At least for Unices? I may be picky, but if flags to the compiler should not change the semantics of the language (in the broadest sense of the definition of semantics) -- what good are they. Why type the things in if they don't affect the generated program (unless they triger off a pretty listing or play music while we wait for errors, I guess ({:) ). Charles Marslett chasm@killer.UUCP