Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Corner cases for log() in our math library


while trying to update our pkgsrc/lang/parrot package to the recently
released 1.5.0 version on NetBSD/i386 4.0, I found that one of the
self-tests failed.  The test in question tests what the result is in
the corner cases of the log() function, particularly what happens when
it's given INFINITY and -INFINITY as an argument.

It expects to get INFINITY and NAN respectively as a result, and our
math library on the other hand returns INFINITY and -INFINITY.

I've submitted the details of this problem in PR#41931.

My problem is twofold.

1) I beleive that our math library returns the wrong value, even if
   the math library is in "posix" mode (which is the default mode).
   Comments from a standards weenie would be appreciated. :)

2) The fix to my small test program by adding a statement of


   fixes the test program's behaviour, but replicating this
   initialization in parrot's NetBSD platform init code does *not* fix
   the problem.

Now...  I've debugged what's up with parrot, and stopped the execution
inside the log() function and in parrot's platform init code, and
it appears that _fdlib_version means two different things to these two
pieces of code:

(gdb) x/x 0x8348fac
0x8348fac <_fdlib_version>:     0xffffffff
(gdb) x/x 0xbbbddf84
0xbbbddf84 <_fdlib_version>:    0x00000002

The first one is in the main program's .data section, the latter one
is in's .data section.

And, yes, <math.h> *is* included in the file implementing the NetBSD
platform init code.

Frankly, I don't understand how I can end up with two different
locations in the data segment which have the same name attached to it.

Looking at the command linking parrot, I also see nothing particular
out of the ordinary:

cc -o ./parrot  src/main.o src/parrot_config.o  
-L/usr/pkgsrc/lang/parrot/work/parrot-1.5.0/blib/lib -lparrot 
-Wl,-R/usr/pkg/lib  -lm -L/usr/pkg/lib  -licuuc -licudata  -lm -lm -lcrypt  
-lintl -Wl,-R/usr/pkg/lib  -L/usr/pkg/lib   -pthread -Wl,-E  

Comments to anything of the above would be much appreciated.


- Håvard

Home | Main Index | Thread Index | Old Index