This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Use -frounding-math for math testsuite
- From: Andreas Jaeger <aj at suse dot com>
- To: libc-alpha at sourceware dot org
- Cc: rguenther at suse dot de
- Date: Wed, 2 May 2012 14:51:16 +0200
- Subject: Re: [PATCH] Use -frounding-math for math testsuite
- References: <hor4v2ah12.fsf@byrd.suse.de>
On Wednesday, May 02, 2012 14:44:57 Andreas Jaeger wrote:
> 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.
The gcc bug is:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53190
-frounding-math does *not* fix the problem, so this change does nothing for
the problem. Still, I think it should be added to be on the safe side...
Andreas
> 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