Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!crdgw1!crdos1!davidsen From: davidsen@crdos1.crd.ge.COM (Wm E Davidsen Jr) Newsgroups: comp.std.c Subject: Re: volatile required? Summary: Error - performs as directed Message-ID: <756@crdos1.crd.ge.COM> Date: 3 Oct 89 14:42:19 GMT References: <712@Aragorn.dde.dk> <16785@watdragon.waterloo.edu> Reply-To: davidsen@crdos1.UUCP (bill davidsen) Organization: GE Corp R&D Center Lines: 26 In article <16785@watdragon.waterloo.edu>, afscian@violet.waterloo.edu (Anthony Scian) writes: | NO. This is a convenient type of oversight that allows so called | "optimizing compilers" like Turbo C and Microsoft C to squeeze | out extra performance from benchmarks. I wrote a reply saying that MSC v4.85 and later didn't do this. Someone replied that if certainly did, if you use the -Oa option. For the record, that's true. If you use -Oa to tell the compiler to ignore aliasing it will. If you use -Ox (perform unsafe optimizations) it will do funny things in complex code. And if you use -M2 (generate 286 code) it won't run on your XT. Having the compiler do just what you requested doesn't seem like an error to me. X3J11 recognized the need to tell compilers in general what is safe when they added volatile (and the brief moments when noalias existed). When a user selects a option which tells the compiler to ignore possible problems s/he certainly shouldn't be surprized if the problems come up. If this happened with the standard -O option I would agree that a bug was present. -- bill davidsen (davidsen@crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen) "The world is filled with fools. They blindly follow their so-called 'reason' in the face of the church and common sense. Any fool can see that the world is flat!" - anon