This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Use -frounding-math for math testsuite


Compiling glibc with GCC 4.7 I got today a failure in the testsuite for
test-ifloat only:

testing float (inline functions)
Failure: Test: lrint_upward (0.2) == 1
Result:
 is:         0
 should be:  1
Failure: Test: lrint_upward (1.4) == 2
Result:
 is:         1
 should be:  2
Failure: Test: lrint_upward (8388600.3) == 8388601
Result:
 is:         8388600
 should be:  8388601

Test suite completed:
  3752 test cases plus 3308 tests for exception flags executed.
  3 errors occurred.

This works with checkout 9568c0c2255045456a09b441f89c6641e27a4bec but
fails with checkout 5ba3cc691c856e5c67a7d4cd4713f20a79f7ba81.

Talking with Richard, we think we found a GCC bug, he's looking into
this.

Still, we should tell GCC that we manipulate the rounding mode and
therefore add -frounding-math to these files that call fesetround. This
works around the bug as well and will avoid problems in the future if
GCC optimizes further.

Tested on Linux/x86-64.

Ok to commit? 

Andreas

2012-05-02  Andreas Jaeger  <aj@suse.de>

	* math/Makefile (CPPFLAGS-test-ildoubl.c): Add -frounding-math
	since we manipulate rounding mode.
	(CPPFLAGS-test-idouble.c): Likewise.
	(CPPFLAGS-test-ifloat.c): Likewise.
	(CFLAGS-test-ldouble.c): Likewise.
	(CFLAGS-test-double.c): Likewise.
	(CFLAGS-test-float.c): Likewise.
	(CFLAGS-test-misc.c): Likewise.
	(CFLAGS-test-test-fenv.c): Likewise.

diff --git a/math/Makefile b/math/Makefile
index abeba7a..60e3899 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -122,19 +122,21 @@ $(objpfx)test-ldouble.o: $(objpfx)libm-test.stmp
 $(objpfx)test-ildoubl.o: $(objpfx)libm-test.stmp
 endif
 
-CFLAGS-test-float.c = -fno-inline -ffloat-store -fno-builtin
-CFLAGS-test-double.c = -fno-inline -ffloat-store -fno-builtin
-CFLAGS-test-ldouble.c = -fno-inline -ffloat-store -fno-builtin
+CFLAGS-test-float.c = -fno-inline -ffloat-store -fno-builtin -frounding-math
+CFLAGS-test-double.c = -fno-inline -ffloat-store -fno-builtin -frounding-math
+CFLAGS-test-ldouble.c = -fno-inline -ffloat-store -fno-builtin -frounding-math
 CFLAGS-test-tgmath.c = -fno-builtin
 CFLAGS-test-tgmath2.c = -fno-builtin
 CFLAGS-test-tgmath-ret.c = -fno-builtin
 CFLAGS-test-powl.c = -fno-builtin
+CFLAGS-test-test-fenv.c = -frounding-math
+CFLAGS-test-misc.c = -frounding-math
 CPPFLAGS-test-ifloat.c = -U__LIBC_INTERNAL_MATH_INLINES -D__FAST_MATH__ \
-			 -DTEST_FAST_MATH -fno-builtin
+			 -DTEST_FAST_MATH -fno-builtin -frounding-math
 CPPFLAGS-test-idouble.c = -U__LIBC_INTERNAL_MATH_INLINES -D__FAST_MATH__ \
-			 -DTEST_FAST_MATH -fno-builtin
+			 -DTEST_FAST_MATH -fno-builtin -frounding-math
 CPPFLAGS-test-ildoubl.c = -U__LIBC_INTERNAL_MATH_INLINES -D__FAST_MATH__ \
-			  -DTEST_FAST_MATH -fno-builtin
+			  -DTEST_FAST_MATH -fno-builtin -frounding-math
 
 
 # The -lieee module sets the _LIB_VERSION_ switch to IEEE mode

-- 
 Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
  SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 NÃrnberg, Germany
   GF: Jeff Hawn,Jennifer Guild,Felix ImendÃrffer,HRB16746 (AG NÃrnberg)
    GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]