From: mcygnus@u.washington.edu (Marc Cygnus)
Subject: OSF1.3 alpha cc bug? (unexplained SIGFPE: HELP!)
Date: 30 Dec 1993 17:33:13 GMT [thread overview]
Message-ID: <2fv3cp$ogj@news.u.washington.edu> (raw)
I skimmed the group and didn't see anything about this (apologies in
advance if it's old news, but I'm about to go out of my skull)...
On a DEC 3500 (Alpha), OSF 1.3, I get FPEs at bizarre times in the code
below. The code opens a binary file of floats (longword) which is just a
big rectangular array; it scans through the entire file looking for minimum
and maximum values.
It's not efficient, it's meant to illustrate the bug.
==============================
#include <stdio.h>
#include <fcntl.h>
main()
{
float fV, fMin, fMax;
int i, j;
int fd;
fd = open( "/big/huge/data/file", O_RDONLY );
fMin = 10000.0;
fMax = -10000.0;
for ( j = 0; j < 3992; j++ ) {
for ( i = 0; i < 1728; i++ ) {
read( fd, &fV, 4 );
printf( "(%d,%d) = %.2f\n", i, j, fV ); /* line 20 */
if ( fV > fMax )
fMax = fV; /* line 23 */
else if ( fV < fMin )
fMin = fV;
}
}
printf( "min,max = %.4f, %.4f\n", fMin, fMax );
}
==============================
Now the fun begins:
% cc -float bug.c -o bug
% bug
(0,0) = 0.00 /* correct first value, incidentally */
Floating exception
% dbx bug
dbx version 3.11.1
...
(dbx) run
(0,0) = 0.00
signal Floating point exception at [main:23 +0x4,0x120001214] fMax = fV;
It gets the signal always at line 23 in this case. Hmm... let's try:
% cc -g -float bug.c -o bug
% bug
Floating exception /* uh-oh, didn't print... ?? */
% dbx bug
...
(dbx) run
signal Floating point exception at [printf:92 ,0x3ff800a2410] ...
(dbx) where
0 printf(...)...
1 main() ["bug.c":20, 0x1200011f8]
Now it gets the signal always at line 20. *grrrrrr*
If I comment out lines 22--25 (the if/else/if block), the program runs fine
if compiled with "-float" and no debugging; if compiled "-g -float", it
crashes as before (as one would expect, I suppose).
If you have ANY CLUE what's going on here, PLEEEEEASE enlighten me. I don't
have all of the most recent OSF release notes, so I don't know if this is
known behavior.
I've tried at least twenty-three variations... pointers, runtime casting,
temporary variables, block reads, other operations besides ">"... I've
tried looking at the assembly. I can't find a workaround.
This is a *major* problem for me because of the number of hours I've put
in and the amount of work this damned thing is holding up. Help!
-Marc W. Cygnus
cygnus@hitl.washington.edu
next reply other threads:[~1993-12-30 17:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1993-12-30 17:33 Marc Cygnus [this message]
1994-01-03 14:42 ` OSF1.3 alpha cc bug? (unexplained SIGFPE: HELP!) Burkhard Neidecker-Lutz
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