summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordas <das@FreeBSD.org>2010-12-03 00:05:49 +0000
committerdas <das@FreeBSD.org>2010-12-03 00:05:49 +0000
commitc282b1e643737544893794ba6246efd065e2076e (patch)
treeed32e272ca8ae6b6a8d9203df143b25951469006
parentdc1c4b92702120dc06348d91c97ca533d7a27bc6 (diff)
downloadFreeBSD-src-c282b1e643737544893794ba6246efd065e2076e.zip
FreeBSD-src-c282b1e643737544893794ba6246efd065e2076e.tar.gz
Disable gcc's built-in rint() function when compiling s_nearbyint.c.
It results in incorrect optimizations that break nearbyint(). PR: 143358 Reviewed by: bde
-rw-r--r--lib/msun/Makefile6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/msun/Makefile b/lib/msun/Makefile
index 87bd954..929af97 100644
--- a/lib/msun/Makefile
+++ b/lib/msun/Makefile
@@ -113,6 +113,12 @@ COMMON_SRCS:= ${COMMON_SRCS:N${i:R}.c}
.endfor
.endif
+# Some files need certain gcc built-in functions to be disabled, since gcc's
+# model of the functions bogusly assumes -fno-trapping-math.
+XRINT_CFLAGS= -fno-builtin-rint -fno-builtin-rintf -fno-builtin-rintl
+CFLAGS+= ${XRINT_CFLAGS}
+XRINT_CFLAGS:= ${.IMPSRC:M*/s_nearbyint.c:C/^.+$/${XRINT_CFLAGS}/:C/^$//}
+
SRCS= ${COMMON_SRCS} ${ARCH_SRCS}
INCS= fenv.h math.h
OpenPOWER on IntegriCloud