Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 May 1997 18:05:44 +0200 (MET DST)
From:      Wolfgang Helbig <helbig@MX.BA-Stuttgart.De>
To:        griepent@wias-berlin.de
Cc:        bugs@FreeBSD.ORG
Subject:   Re: Underflow floating point exceptions under FreeBSD 2.1.5
Message-ID:  <199705051605.SAA20925@helbig.informatik.ba-stuttgart.de>
In-Reply-To: <9705051344.AA16083@pascal.wias-berlin.de> from "griepent@wias-berlin.de" at "May 5, 97 03:44:49 pm"

index | next in thread | previous in thread | raw e-mail

> Hello, FreeBSD experts!
> 
> I am going to use numerical applications on a X11 Window desktop and
> I want to work with the nice and stable FreeBSD system at home.
> To stay compatible with an institute I want to use a numerical
> package written in ANSI-C which works flawlessly on DEC and SGI machines.
> I was able to compile (gcc-2.6.3) the package on several Intel
> platforms (from 486 DX to PentiumPro) under FreeBSD-2.1.5.
> 
> Trying to run it there always occured strange underflow floating
> point exceptions in code fragments computing mathematical
> functions like
> 
> 	sqrt, cos, log
> 
> with harmless arguments of type double in the range of 1.0e-20 to 1.0e+20,
> which should be normally no big deal in the IEEE 754 world!
> 
> My first idea was to recompile the code with gnu debugger support
> enabled and no optimization options. So I have got the same
> underflow floating point exceptions, but now more localized, namely
> in the above mathematical functions contained in the shared library
> 
> 	/usr/lib/libm.so
> 
> My next idea was a little bit more successful:
> 
> 	recompiling the libm sources with gdb support enabled.
> 
> Building the numerical package with that new math library and setting
> appropriate breakpoints in the sqrt, log and cos function calls of the
> library I was able to localize the underflows in the loops which
> iteratively compute the values of that functions. 
> 
> Remembering a similar looping problem (many years ago on other platforms)
> I have decided to
> 
> 	recompile the libm sources with no optimization!
> 
> Again building the package with that math library the code is running now
> and we get the same numerical results and performance as on the DEC or SGI 
> machines!
> 
> Now my questions:
> 
> (1) Let me assume that the original libm shared library was compiled
>     also with the gcc-2.6.3 compiler.
>     Is there a (known) optimization bug in the gcc-2.6.3 compiler?

Your assumption is correct. And there are known (and unknown :-) ) optimization
bugs in gcc-2.6.3. That's why virtual all system software in FreeBSD
is compiled with the lowest "optimization" flag -O and not with the even
buggier -O2 etc.

The bug you described is unknown (at least to me).

> (2) What about the other system libraries? Perhaps I have to be aware
>     to run in trouble in a similar manner!
> (3) Is there any hope to get rid of that problems in one of the next
>     versions of FreeBSD or newer gcc versions? 

I think so. FreeBSD 2.2.X and -current is compiled with gcc-2.7.2, but
the bug might have survived the version switch, so I would ask you
to send me a minimal C program that exposes the error you were experiencing.

Thanks in advance,

Wolfgang


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199705051605.SAA20925>