From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,e96065738a96e678,start X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1994-06-23 11:35:59 PST Path: bga.com!news.sprintlink.net!hookup!yeshua.marcam.com!MathWorks.Com!europa.eng.gtefsd.com!howland.reston.ans.net!gatech!newsfeed.pitt.edu!toads.pgh.pa.us!news.sei.cmu.edu!bb3.andrew.cmu.edu!andrew.cmu.edu!ssb6+ From: Stan Joseph Simon Newsgroups: comp.unix.osf.osf1 Subject: cc -O bug? Date: Thu, 23 Jun 1994 13:56:55 -0400 Organization: Sophomore, Math/Computer Science, Carnegie Mellon, Pittsburgh, PA Message-ID: NNTP-Posting-Host: po2.andrew.cmu.edu I have a problem with cc on the DEC alpha. When I compile the following piece of code with "cc test.c" the program runs correctly. --test.c-------------------------------------- #include int main(){ double T, F7=78125.0, T30= 1073741824.0; T= F7 / T30; printf("T=%lf, F7=%lf, T30=%lf, f7/t30=%.15lf\n", T, F7, T30, F7 / T30); return 0; } --end test.c-------------------------------------- However, when I use optimization "cc -O test.c" I get incorrect output--the division comes out to 0. This happens with optimization levels -O2 and -O3, but not -O1. (A similar problem occurs with DEC's cxx compiler.) Is there a solution to this? Or should I just not use optimization? I am using osf 1.3. Stan