cvs commit: src/lib/msun/bsdsrc b_log.c b_tgamma.c mathimpl.h
Bruce Evans
bde at FreeBSD.org
Mon Sep 19 04:28:22 PDT 2005
bde 2005-09-19 11:28:19 UTC
FreeBSD src repository
Modified files:
lib/msun/bsdsrc b_log.c b_tgamma.c mathimpl.h
Log:
Fixed aliasing bugs in TRUNC() by using the fdlibm macros for access
to doubles as bits. fdlibm-1.1 had similar aliasing bugs, but these
were fixed by NetBSD or Cygnus before a modified version of fdlibm was
imported in 1994. TRUNC() is only used by tgamma() and some
implementation-detail functions. The aliasing bugs were detected by
compiling with gcc -O2 but don't seem to have broken tgamma() on i386's
or amd64's. They broke my modified version of tgamma().
Moved the definition of TRUNC() to mathimpl.h so that it can be fixed
in one place, although the general version is even slower than necessary
because it has to operate on pointers to volatiles to handle its arg
sometimes being volatile. Inefficiency of the fdlibm macros slows
down libm generally, and tgamma() is a relatively unimportant part of
libm. The macros act as if on 32-bit words in memory, so they are
hard to optimize to direct actions on 64-bit double registers for
(non-i386) machines where this is possible. The optimization is too
hard for gcc on amd64's, and declaring variables as volatile makes it
impossible.
Revision Changes Path
1.8 +1 -4 src/lib/msun/bsdsrc/b_log.c
1.7 +0 -8 src/lib/msun/bsdsrc/b_tgamma.c
1.6 +25 -0 src/lib/msun/bsdsrc/mathimpl.h
More information about the cvs-src
mailing list