Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!chinacat!sequoia!rpp386!jfh From: jfh@rpp386.cactus.org (John F Haugh II) Newsgroups: comp.unix.aix Subject: Re: cc -O producing faulty code Message-ID: <19351@rpp386.cactus.org> Date: 2 Jun 91 04:22:09 GMT References: <1991Jun1.065826.5526@minyos.xx.rmit.oz.au> Reply-To: jfh@rpp386.cactus.org (John F Haugh II) Distribution: comp Organization: Lone Star Cat Emporium and BBQ Grill Lines: 28 X-Clever-Slogan: Help Prevent Robbery. Tax the IRS. In article <1991Jun1.065826.5526@minyos.xx.rmit.oz.au> s900387@minyos.xx.rmit.oz.au (Craig Macbride) writes: >I have found a situation where a perfectly simple piece of C code which does >some strcpy()s and fprintf()s works fine without the -O switch, but produces >code which generates incorrect output when -O is used. (The code produced by >the optimiser is also longer - I assume it's optimising for speed?) > >Has anyone else come across this situation on an RS6000 before? I always used >to compile everything with -O on Unix machines, but it seems not a very safe >thing to do with this compiler. You need to give the level of the compiler that is failing as well as an example of the code that breaks the optimizer. I will start with the statement that most compiler bugs aren't. I saw quite a few things that were called "compiler bugs" that were really caused by incorrect argument passing. The proper argument just happened to be in the correct register when optimization was turned off. Now that I've said that, the S/6000 compiler has, in the past, had problems with generating bad code with the optimizer turned on. So far as I know, the currently being delivered compiler has no such problems. You need to come up with the smallest fragment of (correct) code that reproduces the problem and send it off to Defect Support. -- John F. Haugh II | Distribution to | UUCP: ...!cs.utexas.edu!rpp386!jfh Ma Bell: (512) 255-8251 | GEnie PROHIBITED :-) | Domain: jfh@rpp386.cactus.org "If liberals interpreted the 2nd Amendment the same way they interpret the rest of the Constitution, gun ownership would be mandatory."