Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: Stan Joseph Simon <ssb6+@andrew.cmu.edu>
Subject: cc -O bug?
Date: Thu, 23 Jun 1994 13:56:55 -0400	[thread overview]
Message-ID: <Yi2Qnbe00WBNE3KhFK@andrew.cmu.edu> (raw)


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 <stdio.h>

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





             reply	other threads:[~1994-06-23 17:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-06-23 17:56 Stan Joseph Simon [this message]
1994-06-24 11:10 ` cc -O bug? system PRIVILEGED account
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox