From b7cb23a66cd14b33c65e4fc95cbc5e6a4ed51fee Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Mon, 12 Jan 2009 06:52:18 -0700 Subject: [PATCH] tests: IRIX 6.2 cc can't compile -0.0 into .data * tests/test-ceill.c (minus_zero): Compute -0.0L at runtime, rather than at compile-time. * tests/test-floorl.c (minus_zero): Likewise. * tests/test-frexpl.c (minus_zero): Likewise. * tests/test-isnan.c (minus_zerol): Likewise. * tests/test-isnanl.h (minus_zero): Likewise. * tests/test-ldexpl.c (minus_zero): Likewise. * tests/test-roundl.c (minus_zero): Likewise. * tests/test-signbit.c (minus_zerol): Likewise. * tests/test-snprintf-posix.h (minus_zerol): Likewise. * tests/test-sprintf-posix.h (minus_zerol): Likewise. * tests/test-truncl.c (minus_zero): Likewise. * tests/test-vasnprintf-posix.c (minus_zerol): Likewise. * tests/test-vasprintf-posix.c (minus_zerol): Likewise. Reported by Tom G. Christensen and Nelson H. F. Beebe. Signed-off-by: Eric Blake --- ChangeLog | 19 +++++++++++++++++++ tests/test-ceill.c | 10 ++++++++-- tests/test-floorl.c | 10 ++++++++-- tests/test-frexpl.c | 10 ++++++++-- tests/test-isnan.c | 10 ++++++++-- tests/test-isnanl.h | 10 ++++++++-- tests/test-ldexpl.c | 10 ++++++++-- tests/test-roundl.c | 12 +++++++++--- tests/test-signbit.c | 10 ++++++++-- tests/test-snprintf-posix.h | 10 ++++++++-- tests/test-sprintf-posix.h | 10 ++++++++-- tests/test-truncl.c | 10 ++++++++-- tests/test-vasnprintf-posix.c | 10 ++++++++-- tests/test-vasprintf-posix.c | 10 ++++++++-- 14 files changed, 124 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0c9bcfbd8..de933c550 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2009-01-12 Eric Blake + + tests: IRIX 6.2 cc can't compile -0.0 into .data + * tests/test-ceill.c (minus_zero): Compute -0.0L at runtime, + rather than at compile-time. + * tests/test-floorl.c (minus_zero): Likewise. + * tests/test-frexpl.c (minus_zero): Likewise. + * tests/test-isnan.c (minus_zerol): Likewise. + * tests/test-isnanl.h (minus_zero): Likewise. + * tests/test-ldexpl.c (minus_zero): Likewise. + * tests/test-roundl.c (minus_zero): Likewise. + * tests/test-signbit.c (minus_zerol): Likewise. + * tests/test-snprintf-posix.h (minus_zerol): Likewise. + * tests/test-sprintf-posix.h (minus_zerol): Likewise. + * tests/test-truncl.c (minus_zero): Likewise. + * tests/test-vasnprintf-posix.c (minus_zerol): Likewise. + * tests/test-vasprintf-posix.c (minus_zerol): Likewise. + Reported by Tom G. Christensen and Nelson H. F. Beebe. + 2009-01-09 Paolo Bonzini regex: fix glibc bug 9697 diff --git a/tests/test-ceill.c b/tests/test-ceill.c index 49e0c6519..d1f0266c5 100644 --- a/tests/test-ceill.c +++ b/tests/test-ceill.c @@ -1,5 +1,5 @@ /* Test of rounding towards positive infinity. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,10 +41,16 @@ /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. So we use minus_zero instead. + IRIX cc can't put -0.0L into .data, but can compute at runtime. Note that the expression -LDBL_MIN * LDBL_MIN does not work on other platforms, such as when cross-compiling to PowerPC on MacOS X 10.5. */ #if defined __hpux || defined __sgi -long double minus_zero = -LDBL_MIN * LDBL_MIN; +static long double +compute_minus_zero (void) +{ + return -LDBL_MIN * LDBL_MIN; +} +# define minus_zero compute_minus_zero () #else long double minus_zero = -0.0L; #endif diff --git a/tests/test-floorl.c b/tests/test-floorl.c index 9a8e5a800..14979e68d 100644 --- a/tests/test-floorl.c +++ b/tests/test-floorl.c @@ -1,5 +1,5 @@ /* Test of rounding towards negative infinity. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,10 +41,16 @@ /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. So we use minus_zero instead. + IRIX cc can't put -0.0L into .data, but can compute at runtime. Note that the expression -LDBL_MIN * LDBL_MIN does not work on other platforms, such as when cross-compiling to PowerPC on MacOS X 10.5. */ #if defined __hpux || defined __sgi -long double minus_zero = -LDBL_MIN * LDBL_MIN; +static long double +compute_minus_zero (void) +{ + return -LDBL_MIN * LDBL_MIN; +} +# define minus_zero compute_minus_zero () #else long double minus_zero = -0.0L; #endif diff --git a/tests/test-frexpl.c b/tests/test-frexpl.c index 91f2d6723..2b968b8ee 100644 --- a/tests/test-frexpl.c +++ b/tests/test-frexpl.c @@ -1,5 +1,5 @@ /* Test of splitting a 'long double' into fraction and mantissa. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -59,10 +59,16 @@ /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. So we use minus_zero instead. + IRIX cc can't put -0.0L into .data, but can compute at runtime. Note that the expression -LDBL_MIN * LDBL_MIN does not work on other platforms, such as when cross-compiling to PowerPC on MacOS X 10.5. */ #if defined __hpux || defined __sgi -long double minus_zero = -LDBL_MIN * LDBL_MIN; +static long double +compute_minus_zero (void) +{ + return -LDBL_MIN * LDBL_MIN; +} +# define minus_zero compute_minus_zero () #else long double minus_zero = -0.0L; #endif diff --git a/tests/test-isnan.c b/tests/test-isnan.c index b5fa11243..61490176c 100644 --- a/tests/test-isnan.c +++ b/tests/test-isnan.c @@ -1,5 +1,5 @@ /* Test of isnand() substitute. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -50,10 +50,16 @@ double zerod = 0.0; /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. So we use minus_zerol instead. + IRIX cc can't put -0.0L into .data, but can compute at runtime. Note that the expression -LDBL_MIN * LDBL_MIN does not work on other platforms, such as when cross-compiling to PowerPC on MacOS X 10.5. */ #if defined __hpux || defined __sgi -long double minus_zerol = -LDBL_MIN * LDBL_MIN; +static long double +compute_minus_zerol (void) +{ + return -LDBL_MIN * LDBL_MIN; +} +# define minus_zerol compute_minus_zerol () #else long double minus_zerol = -0.0L; #endif diff --git a/tests/test-isnanl.h b/tests/test-isnanl.h index 8567f39ec..37e28579c 100644 --- a/tests/test-isnanl.h +++ b/tests/test-isnanl.h @@ -1,5 +1,5 @@ /* Test of isnanl() substitute. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -35,10 +35,16 @@ /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. So we use minus_zero instead. + IRIX cc can't put -0.0L into .data, but can compute at runtime. Note that the expression -LDBL_MIN * LDBL_MIN does not work on other platforms, such as when cross-compiling to PowerPC on MacOS X 10.5. */ #if defined __hpux || defined __sgi -long double minus_zero = -LDBL_MIN * LDBL_MIN; +static long double +compute_minus_zero (void) +{ + return -LDBL_MIN * LDBL_MIN; +} +# define minus_zero compute_minus_zero () #else long double minus_zero = -0.0L; #endif diff --git a/tests/test-ldexpl.c b/tests/test-ldexpl.c index 272fc4f0c..395c00fb0 100644 --- a/tests/test-ldexpl.c +++ b/tests/test-ldexpl.c @@ -1,5 +1,5 @@ /* Test of multiplying a 'long double' by a power of 2. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,10 +41,16 @@ /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. So we use minus_zero instead. + IRIX cc can't put -0.0L into .data, but can compute at runtime. Note that the expression -LDBL_MIN * LDBL_MIN does not work on other platforms, such as when cross-compiling to PowerPC on MacOS X 10.5. */ #if defined __hpux || defined __sgi -long double minus_zero = -LDBL_MIN * LDBL_MIN; +static long double +compute_minus_zero (void) +{ + return -LDBL_MIN * LDBL_MIN; +} +# define minus_zero compute_minus_zero () #else long double minus_zero = -0.0L; #endif diff --git a/tests/test-roundl.c b/tests/test-roundl.c index 1da3f4416..51cd1cdd9 100644 --- a/tests/test-roundl.c +++ b/tests/test-roundl.c @@ -1,9 +1,9 @@ /* Test of rounding to nearest, breaking ties away from zero. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -43,10 +43,16 @@ /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. So we use minus_zero instead. + IRIX cc can't put -0.0L into .data, but can compute at runtime. Note that the expression -LDBL_MIN * LDBL_MIN does not work on other platforms, such as when cross-compiling to PowerPC on MacOS X 10.5. */ #if defined __hpux || defined __sgi -long double minus_zero = -LDBL_MIN * LDBL_MIN; +static long double +compute_minus_zero (void) +{ + return -LDBL_MIN * LDBL_MIN; +} +# define minus_zero compute_minus_zero () #else long double minus_zero = -0.0L; #endif diff --git a/tests/test-signbit.c b/tests/test-signbit.c index d6efe08b0..97f68e6a7 100644 --- a/tests/test-signbit.c +++ b/tests/test-signbit.c @@ -1,5 +1,5 @@ /* Test of signbit() substitute. - Copyright (C) 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -49,10 +49,16 @@ long double zerol = 0.0L; /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. So we use minus_zerol instead. + IRIX cc can't put -0.0L into .data, but can compute at runtime. Note that the expression -LDBL_MIN * LDBL_MIN does not work on other platforms, such as when cross-compiling to PowerPC on MacOS X 10.5. */ #if defined __hpux || defined __sgi -long double minus_zerol = -LDBL_MIN * LDBL_MIN; +static long double +compute_minus_zerol (void) +{ + return -LDBL_MIN * LDBL_MIN; +} +# define minus_zerol compute_minus_zerol () #else long double minus_zerol = -0.0L; #endif diff --git a/tests/test-snprintf-posix.h b/tests/test-snprintf-posix.h index 09b186782..9fb2e67d1 100644 --- a/tests/test-snprintf-posix.h +++ b/tests/test-snprintf-posix.h @@ -1,5 +1,5 @@ /* Test of POSIX compatible vsnprintf() and snprintf() functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,10 +33,16 @@ double zerod = 0.0; /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. So we use minus_zerol instead. + IRIX cc can't put -0.0L into .data, but can compute at runtime. Note that the expression -LDBL_MIN * LDBL_MIN does not work on other platforms, such as when cross-compiling to PowerPC on MacOS X 10.5. */ #if defined __hpux || defined __sgi -long double minus_zerol = -LDBL_MIN * LDBL_MIN; +static long double +compute_minus_zerol (void) +{ + return -LDBL_MIN * LDBL_MIN; +} +# define minus_zerol compute_minus_zerol () #else long double minus_zerol = -0.0L; #endif diff --git a/tests/test-sprintf-posix.h b/tests/test-sprintf-posix.h index 5fb9250c1..e8b8ba877 100644 --- a/tests/test-sprintf-posix.h +++ b/tests/test-sprintf-posix.h @@ -1,5 +1,5 @@ /* Test of POSIX compatible vsprintf() and sprintf() functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,10 +33,16 @@ double zerod = 0.0; /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. So we use minus_zerol instead. + IRIX cc can't put -0.0L into .data, but can compute at runtime. Note that the expression -LDBL_MIN * LDBL_MIN does not work on other platforms, such as when cross-compiling to PowerPC on MacOS X 10.5. */ #if defined __hpux || defined __sgi -long double minus_zerol = -LDBL_MIN * LDBL_MIN; +static long double +compute_minus_zerol (void) +{ + return -LDBL_MIN * LDBL_MIN; +} +# define minus_zerol compute_minus_zerol () #else long double minus_zerol = -0.0L; #endif diff --git a/tests/test-truncl.c b/tests/test-truncl.c index 4b00e350a..aad677d6c 100644 --- a/tests/test-truncl.c +++ b/tests/test-truncl.c @@ -1,5 +1,5 @@ /* Test of rounding towards zero. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,10 +41,16 @@ /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. So we use minus_zero instead. + IRIX cc can't put -0.0L into .data, but can compute at runtime. Note that the expression -LDBL_MIN * LDBL_MIN does not work on other platforms, such as when cross-compiling to PowerPC on MacOS X 10.5. */ #if defined __hpux || defined __sgi -long double minus_zero = -LDBL_MIN * LDBL_MIN; +static long double +compute_minus_zero (void) +{ + return -LDBL_MIN * LDBL_MIN; +} +# define minus_zero compute_minus_zero () #else long double minus_zero = -0.0L; #endif diff --git a/tests/test-vasnprintf-posix.c b/tests/test-vasnprintf-posix.c index bf125480a..07c173e1a 100644 --- a/tests/test-vasnprintf-posix.c +++ b/tests/test-vasnprintf-posix.c @@ -1,5 +1,5 @@ /* Test of POSIX compatible vasnprintf() and asnprintf() functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -58,10 +58,16 @@ double zerod = 0.0; /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. So we use minus_zerol instead. + IRIX cc can't put -0.0L into .data, but can compute at runtime. Note that the expression -LDBL_MIN * LDBL_MIN does not work on other platforms, such as when cross-compiling to PowerPC on MacOS X 10.5. */ #if defined __hpux || defined __sgi -long double minus_zerol = -LDBL_MIN * LDBL_MIN; +static long double +compute_minus_zerol (void) +{ + return -LDBL_MIN * LDBL_MIN; +} +# define minus_zerol compute_minus_zerol () #else long double minus_zerol = -0.0L; #endif diff --git a/tests/test-vasprintf-posix.c b/tests/test-vasprintf-posix.c index 2f287fc90..5f471b444 100644 --- a/tests/test-vasprintf-posix.c +++ b/tests/test-vasprintf-posix.c @@ -1,5 +1,5 @@ /* Test of POSIX compatible vasprintf() and asprintf() functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -57,10 +57,16 @@ double zerod = 0.0; /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. So we use minus_zerol instead. + IRIX cc can't put -0.0L into .data, but can compute at runtime. Note that the expression -LDBL_MIN * LDBL_MIN does not work on other platforms, such as when cross-compiling to PowerPC on MacOS X 10.5. */ #if defined __hpux || defined __sgi -long double minus_zerol = -LDBL_MIN * LDBL_MIN; +static long double +compute_minus_zerol (void) +{ + return -LDBL_MIN * LDBL_MIN; +} +# define minus_zerol compute_minus_zerol () #else long double minus_zerol = -0.0L; #endif -- 2.11.0