Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!paperboy!think.com!sdd.hp.com!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!pacbell.com!ucsd!hub.ucsb.edu!sbphy.physics.ucsb.edu!hbo From: hbo@sbphy.physics.ucsb.edu (Howard B Owen) Newsgroups: comp.unix.ultrix Subject: Ultrix 4.0/cc 2.1 bug Keywords: cc bug printf double i/o Message-ID: <9428@hub.ucsb.edu> Date: 26 Feb 91 00:29:38 GMT References: <2238.27c3b13c@idx.com> <1991Feb25.171412.2506@aio.jsc.nasa.gov> Sender: news@hub.ucsb.edu Reply-To: hbo@sbphy.physics.ucsb.edu (Howard B Owen) Organization: UCSB Physics Department Lines: 65 I have a problem that I seem to recall was discussed in this group.: Environment: Mips cc v 2.1/Ultrix v4.0/DECstation 5000 Problem: Output of doubles is garbled when mixed with other i/o statements. Example: #include main() { FILE *outfile = fopen( "quantum.dat", "w" ); double energy = 0.01; printf("%f\n", energy); printf("%f\n", energy); fclose (outfile); } This program, compiled with "cc bug.c -o bug", produces the following output: 0.010000 19991592789737117000000000000000000000.000000 If the fopen and fclose statements are removed, or if a value is assigned to "energy" after the first printf, Then the output is as expected. Also, the following program displays a similar problem: #include #include main() { float a= -0.1; double mu = -0.1; printf("%15.3e\n",mu); printf("%15.3e\n",a); printf("%15.3e\n",mu); } The output from this program, compiled like the last one, is: -1.000e-01 -1.000e-01 -2.353e-185 I can't believe such a severe bug could be part of a correctly configured system. We have FORTRAN v 2.1 installed, as the following excerpt from setld -i shows: F77BACKEND021 installed V2.1 Compiler Back End F77BASE021 installed F77 Programming Environment F77MAN021 installed F77 Manual Pages F77UNSUP021 installed F77 Unsupported Utilities Any help you could offer would be appreciated. Thanks, -- Howard Owen, Computer Systems Manager internet: hbo@sbphy.physics.ucsb.edu Physics Computer Services BITNET: HBO@VOODOO.BITNET University of California, Santa Barbara DECNET Internet: 45180::HBO "I am not a pay TV service!" Telephone: 805-893-8366 (work) Brought to you by Super Global Mega Corp .com