Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!wuarchive!usc!snorkelwacker!mintaka!spdcc!ima!esegue!compilers-sender From: johnv@metaware.com (John Vinopal) Newsgroups: comp.compilers Subject: Re: RS/6000 Optimizer breaks code -- suggestions? Keywords: debug, optimize, C Message-ID: <581@metaware.metaware.com> Date: 27 Aug 90 20:48:40 GMT References: <9008241836.AA07588@sn1987a.compass.com> Sender: compilers-sender@esegue.segue.boston.ma.us Reply-To: johnv@metaware.com (John Vinopal) Organization: Metaware Incorporated, Santa Cruz, CA Lines: 21 Approved: compilers@esegue.segue.boston.ma.us [Commentary deleted] >But, having said all that, I actually agree with your assertion that the >implentation is not "sane", but only because the situations where it's >safe to rearrange a union are probably rare, and more often than not will >occur because the programmer was trying to use the union to fake up a >type cast. So the optimization is more likely to hurt than to help. > >[Can someone run the original code through the RS/6000 compiler, look at >the object code, and report whether the compiler is in fact doing something >strange? IBM is usually pretty good at reading standards. -John] The union in this case was in fact used as a type cast of sorts; a method to prevent a short from overflowing. Bad style and not portable begins to sum up this approach. However... This has been submitted to IBM tech and verified as a real bug. If anyone would like a 'clean' copy of the code in question, please mail requests to banshee@ucscb.UCSC.EDU. -- Send compilers articles to compilers@esegue.segue.boston.ma.us {ima | spdcc | world}!esegue. Meta-mail to compilers-request@esegue.