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

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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] Fix nexttowardl if compiling new program against new glibc headers with -mlong-double-64


Hi!

I have (hopefully) finished the ldbl-dbl-tst.c testcase I posted
a few weeks ago and tested it in various ways on ppc{32,64} and s390{,x}
with already installed new glibc, in all cases using -O0 -fno-builtin
to avoid compiler/inlines optimizing stuff out.
1) compiled/linked the program against older (non-ldbl) glibc, run against old glibc
2) run the same binary against new glibc
3) compile against old glibc, link with -lnldbl_nonshared -lm, run against new glibc
4) compile/run against new glibc with -mlong-double-64
5) compile/run against new glibc with -mlong-double-128
Repeat the same also for -D_FORTIFY_SOURCE=2.

The only failures were in 4) on s390{,x} where it segfaulted, fixed by
the patch below, and 5) on ppc{32,64} where the test on line 262 failed,
due to apparently different rounding.
#include <printf.h>
#include <stdio.h>

int main (void)
{
  register_printf_function ('B', printf_size, printf_size_info);
  register_printf_function ('b', printf_size, printf_size_info);
  printf ("%LB %LB %B %B\n", 3.25L, 7834.5L, 3.75, 7835.5);
  puts ("Expected");
  printf ("3.250  7.835K 3.750  7.835K\n");
  return 0;
}

on ppc{32,64} with -mlong-double-128 prints:
3.250  7.834K 3.750  7.835K
Expected
3.250  7.835K 3.750  7.835K
while on x86_64 or s390/s390x with -mlong-double-128 prints the expected
output.

2006-02-02  Jakub Jelinek  <jakub@redhat.com>

	* math/math.h [__LDBL_COMPAT && __USE_ISOC99] (nexttowardl): New
	prototype.

--- libc/math/math.h.jj	2006-01-14 17:41:02.000000000 +0100
+++ libc/math/math.h	2006-02-02 15:26:29.000000000 +0100
@@ -110,6 +110,9 @@ extern float __REDIRECT_NTH (nexttowardf
      __attribute__ ((__const__));
 extern double __REDIRECT_NTH (nexttoward, (double __x, long double __y),
 			      nextafter) __attribute__ ((__const__));
+extern long double __REDIRECT_NTH (nexttowardl,
+				   (long double __x, long double __y),
+				   nextafter) __attribute__ ((__const__));
 #    endif
 #   endif
 

	Jakub

Attachment: ldbl-dbl-tst.c
Description: Text document


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