Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* OSF1.3 alpha cc bug? (unexplained SIGFPE: HELP!)
@ 1993-12-30 17:33 Marc Cygnus
  1994-01-03 14:42 ` Burkhard Neidecker-Lutz
  0 siblings, 1 reply; 2+ messages in thread
From: Marc Cygnus @ 1993-12-30 17:33 UTC (permalink / 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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: OSF1.3 alpha cc bug? (unexplained SIGFPE: HELP!)
  1993-12-30 17:33 OSF1.3 alpha cc bug? (unexplained SIGFPE: HELP!) Marc Cygnus
@ 1994-01-03 14:42 ` Burkhard Neidecker-Lutz
  0 siblings, 0 replies; 2+ messages in thread
From: Burkhard Neidecker-Lutz @ 1994-01-03 14:42 UTC (permalink / raw)


In article <2fv3cp$ogj@news.u.washington.edu> mcygnus@u.washington.edu (Marc Cygnus) writes:
>
>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

Whenever you read a value with this program that invokes a floating point
exception, it is bound to crash like you observe. To enable the floating
point support, compile with

	cc -ieee_with_no_inexact

and it will work.

		Burkhard Neidecker-Lutz

Distributed Multimedia Group, CEC Karlsruhe  
BERKOM II Project
Digital Equipment Corporation
neideck@nestvx.enet.dec.com

	


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1994-01-03 14:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1993-12-30 17:33 OSF1.3 alpha cc bug? (unexplained SIGFPE: HELP!) Marc Cygnus
1994-01-03 14:42 ` Burkhard Neidecker-Lutz

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