diff options
| author | Ulrich Drepper <drepper@redhat.com> | 2007-07-12 18:17:11 +0000 |
|---|---|---|
| committer | Ulrich Drepper <drepper@redhat.com> | 2007-07-12 18:17:11 +0000 |
| commit | 1c298d08873e72a2339161517da660bdaff0e3f8 (patch) | |
| tree | 8dc2c8b8521576cc303468e3203db0eb4d262b0a | |
| parent | f98c2d06bb4e04e59bb067b301bacf880fb72a9f (diff) | |
| download | glibc-1c298d08873e72a2339161517da660bdaff0e3f8.tar.xz glibc-1c298d08873e72a2339161517da660bdaff0e3f8.zip | |
[BZ #4775, BZ #4776]
2007-07-12 Jakub Jelinek <jakub@redhat.com>
[BZ #4775]
* math/tgmath.h (__tgmath_real_type_sub): Formatting.
(__tgmath_real_type): Fix if expr is const int or other const
qualified integral type.
(__TGMATH_UNARY_REAL_ONLY): Rewritten to avoid using statement
expressions and handle const qualified arguments.
(__TGMATH_BINARY_FIRST_REAL_ONLY, __TGMATH_UNARY_REAL_IMAG,
__TGMATH_UNARY_REAL_IMAG_RET_REAL): Likewise.
(__TGMATH_UNARY_REAL_RET_ONLY): Rewritten to avoid using
statement expressions.
(__TGMATH_BINARY_REAL_ONLY, __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY,
__TGMATH_TERNARY_REAL_ONLY, __TGMATH_BINARY_REAL_IMAG): Likewise.
(__TGMATH_UNARY_IMAG): Define.
(conj, cproj): Use __TGMATH_UNARY_IMAG macro.
* math/Makefile (tests): Add test-tgmath2.
(CFLAGS-test-tgmath2.c): Add.
* math/test-tgmath.c (fy, dy, ly, fz, dz, lz, count_cdouble,
count_cfloat, count_cldouble): New variables.
(NCCALLS): Define.
(main): Check number of complex calls as well.
(F(compile_test)): Add complex tests and tests with const qualified
arguments.
(y, z, ccount): Define.
(F(cacos), F(casin), F(catan), F(ccos), F(csin), F(ctan), F(cacosh),
F(casinh), F(catanh), F(ccosh), F(csinh), F(ctanh), F(cexp), F(clog),
F(csqrt), F(cpow), F(cabs), F(carg), F(creal), F(cimag), F(conj),
F(cproj)): New functions.
* math/test-tgmath2.c: New test.
2007-07-11 Jakub Jelinek <jakub@redhat.com>
[BZ #4776]
* elf/dl-load.c (_dl_rtld_di_serinfo): Output / in LD_LIBRARY_PATH,
RPATH etc. as "/" rather than "", don't segfault on empty paths,
instead output ".".
* dlfcn/Makefile (distribute): Add glreflib3.c.
(module-names): Add glreflib3.
($(objpfx)tst-dlinfo.out): Depend on glreflib3.so rather than
glreflib1.so.
(LDFLAGS_glreflib3.so): New.
* dlfcn/tst-dlinfo.c (do_test): Load glreflib3.so instead of
glreflib1.so.
* dlfcn/glreflib3.c: New file.
* intl/finddomain.c (_nl_find_domain): If _nl_explode_name
returned -1, return NULL.
* intl/explodename.c (_nl_explode_name): Return -1 if
_nl_normalize_codeset failed.
| -rw-r--r-- | ChangeLog | 51 | ||||
| -rw-r--r-- | dlfcn/Makefile | 10 | ||||
| -rw-r--r-- | dlfcn/glreflib3.c | 1 | ||||
| -rw-r--r-- | dlfcn/tst-dlinfo.c | 2 | ||||
| -rw-r--r-- | elf/dl-load.c | 9 | ||||
| -rw-r--r-- | intl/explodename.c | 6 | ||||
| -rw-r--r-- | intl/finddomain.c | 5 | ||||
| -rw-r--r-- | math/Makefile | 3 | ||||
| -rw-r--r-- | math/test-tgmath.c | 494 | ||||
| -rw-r--r-- | math/test-tgmath2.c | 488 | ||||
| -rw-r--r-- | math/tgmath.h | 321 |
11 files changed, 1143 insertions, 247 deletions
@@ -1,3 +1,54 @@ +2007-07-12 Jakub Jelinek <jakub@redhat.com> + + [BZ #4775] + * math/tgmath.h (__tgmath_real_type_sub): Formatting. + (__tgmath_real_type): Fix if expr is const int or other const + qualified integral type. + (__TGMATH_UNARY_REAL_ONLY): Rewritten to avoid using statement + expressions and handle const qualified arguments. + (__TGMATH_BINARY_FIRST_REAL_ONLY, __TGMATH_UNARY_REAL_IMAG, + __TGMATH_UNARY_REAL_IMAG_RET_REAL): Likewise. + (__TGMATH_UNARY_REAL_RET_ONLY): Rewritten to avoid using + statement expressions. + (__TGMATH_BINARY_REAL_ONLY, __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY, + __TGMATH_TERNARY_REAL_ONLY, __TGMATH_BINARY_REAL_IMAG): Likewise. + (__TGMATH_UNARY_IMAG): Define. + (conj, cproj): Use __TGMATH_UNARY_IMAG macro. + * math/Makefile (tests): Add test-tgmath2. + (CFLAGS-test-tgmath2.c): Add. + * math/test-tgmath.c (fy, dy, ly, fz, dz, lz, count_cdouble, + count_cfloat, count_cldouble): New variables. + (NCCALLS): Define. + (main): Check number of complex calls as well. + (F(compile_test)): Add complex tests and tests with const qualified + arguments. + (y, z, ccount): Define. + (F(cacos), F(casin), F(catan), F(ccos), F(csin), F(ctan), F(cacosh), + F(casinh), F(catanh), F(ccosh), F(csinh), F(ctanh), F(cexp), F(clog), + F(csqrt), F(cpow), F(cabs), F(carg), F(creal), F(cimag), F(conj), + F(cproj)): New functions. + * math/test-tgmath2.c: New test. + +2007-07-11 Jakub Jelinek <jakub@redhat.com> + + [BZ #4776] + * elf/dl-load.c (_dl_rtld_di_serinfo): Output / in LD_LIBRARY_PATH, + RPATH etc. as "/" rather than "", don't segfault on empty paths, + instead output ".". + * dlfcn/Makefile (distribute): Add glreflib3.c. + (module-names): Add glreflib3. + ($(objpfx)tst-dlinfo.out): Depend on glreflib3.so rather than + glreflib1.so. + (LDFLAGS_glreflib3.so): New. + * dlfcn/tst-dlinfo.c (do_test): Load glreflib3.so instead of + glreflib1.so. + * dlfcn/glreflib3.c: New file. + + * intl/finddomain.c (_nl_find_domain): If _nl_explode_name + returned -1, return NULL. + * intl/explodename.c (_nl_explode_name): Return -1 if + _nl_normalize_codeset failed. + 2007-07-10 Ulrich Drepper <drepper@redhat.com> [BZ #4773] diff --git a/dlfcn/Makefile b/dlfcn/Makefile index e8fbab2958..1324007e27 100644 --- a/dlfcn/Makefile +++ b/dlfcn/Makefile @@ -23,7 +23,8 @@ libdl-routines := dlopen dlclose dlsym dlvsym dlerror dladdr dladdr1 dlinfo \ dlmopen dlfcn routines := $(patsubst %,s%,$(filter-out dlfcn,$(libdl-routines))) elide-routines.os := $(routines) -distribute := dlopenold.c glreflib1.c glreflib2.c failtestmod.c \ +distribute := dlopenold.c glreflib1.c glreflib2.c glreflib3.c \ + failtestmod.c \ defaultmod1.c defaultmod2.c errmsg1mod.c modatexit.c \ modcxaatexit.c modstatic.c modstatic2.c \ bug-dlsym1-lib1.c bug-dlsym1-lib2.c bug-atexit1-lib.c \ @@ -43,8 +44,8 @@ tests = glrefmain failtest tst-dladdr default errmsg1 tstcxaatexit \ bug-dlopen1 bug-dlsym1 tst-dlinfo bug-atexit1 bug-atexit2 \ bug-atexit3 tstatexit endif -modules-names = glreflib1 glreflib2 failtestmod defaultmod1 defaultmod2 \ - errmsg1mod modatexit modcxaatexit \ +modules-names = glreflib1 glreflib2 glreflib3 failtestmod defaultmod1 \ + defaultmod2 errmsg1mod modatexit modcxaatexit \ bug-dlsym1-lib1 bug-dlsym1-lib2 bug-atexit1-lib \ bug-atexit2-lib bug-atexit3-lib @@ -83,7 +84,8 @@ $(objpfx)tst-dladdr: $(libdl) $(objpfx)tst-dladdr.out: $(objpfx)glreflib1.so $(objpfx)tst-dlinfo: $(libdl) -$(objpfx)tst-dlinfo.out: $(objpfx)glreflib1.so +$(objpfx)tst-dlinfo.out: $(objpfx)glreflib3.so +LDFLAGS-glreflib3.so = -Wl,-rpath,: LDFLAGS-default = $(LDFLAGS-rdynamic) $(objpfx)default: $(libdl) $(objpfx)defaultmod1.so $(objpfx)defaultmod2.so diff --git a/dlfcn/glreflib3.c b/dlfcn/glreflib3.c new file mode 100644 index 0000000000..5ac7befa6b --- /dev/null +++ b/dlfcn/glreflib3.c @@ -0,0 +1 @@ +#include "glreflib1.c" diff --git a/dlfcn/tst-dlinfo.c b/dlfcn/tst-dlinfo.c index 70906ebdf1..16355a1aa3 100644 --- a/dlfcn/tst-dlinfo.c +++ b/dlfcn/tst-dlinfo.c @@ -29,7 +29,7 @@ do_test (void) { int status = 0; - void *handle = dlopen ("glreflib1.so", RTLD_NOW); + void *handle = dlopen ("glreflib3.so", RTLD_NOW); if (handle == NULL) error (EXIT_FAILURE, 0, "cannot load: glreflib1.so: %s", dlerror ()); diff --git a/elf/dl-load.c b/elf/dl-load.c index 73e9b9ce7b..1a84e0fe43 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -2273,14 +2273,17 @@ _dl_rtld_di_serinfo (struct link_map *loader, Dl_serinfo *si, bool counting) if (counting) { si->dls_cnt++; - si->dls_size += r->dirnamelen; + si->dls_size += r->dirnamelen < 2 ? r->dirnamelen : 2; } else { Dl_serpath *const sp = &si->dls_serpath[idx++]; sp->dls_name = allocptr; - allocptr = __mempcpy (allocptr, - r->dirname, r->dirnamelen - 1); + if (r->dirnamelen < 2) + *allocptr++ = r->dirnamelen ? '/' : '.'; + else + allocptr = __mempcpy (allocptr, + r->dirname, r->dirnamelen - 1); *allocptr++ = '\0'; sp->dls_flags = flags; } diff --git a/intl/explodename.c b/intl/explodename.c index 8e326ead53..321204d8df 100644 --- a/intl/explodename.c +++ b/intl/explodename.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-2002, 2003, 2006 Free Software Foundation, Inc. +/* Copyright (C) 1995-2002, 2003, 2006, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. @@ -108,7 +108,9 @@ _nl_explode_name (name, language, modifier, territory, codeset, { *normalized_codeset = _nl_normalize_codeset (*codeset, cp - *codeset); - if (strcmp (*codeset, *normalized_codeset) == 0) + if (*normalized_codeset == NULL) + return -1; + else if (strcmp (*codeset, *normalized_codeset) == 0) free ((char *) *normalized_codeset); else mask |= XPG_NORM_CODESET; diff --git a/intl/finddomain.c b/intl/finddomain.c index 9806ba12cd..54e617ca99 100644 --- a/intl/finddomain.c +++ b/intl/finddomain.c @@ -1,5 +1,5 @@ /* Handle list of needed message catalogs - Copyright (C) 1995-1999, 2000, 2001, 2002, 2004, 2006 + Copyright (C) 1995-1999, 2000, 2001, 2002, 2004, 2006, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Ulrich Drepper <drepper@gnu.org>, 1995. @@ -126,6 +126,9 @@ _nl_find_domain (dirname, locale, domainname, domainbinding) we use XPG4 style, and `_', `+', and `,' if we use CEN syntax. */ mask = _nl_explode_name (locale, &language, &modifier, &territory, &codeset, &normalized_codeset); + if (mask == -1) + /* This means we are out of core. */ + return NULL; /* We need to protect modifying the _NL_LOADED_DOMAINS data. */ __libc_rwlock_wrlock (lock); diff --git a/math/Makefile b/math/Makefile index 1ab1b13b07..7e3a626c63 100644 --- a/math/Makefile +++ b/math/Makefile @@ -90,7 +90,7 @@ distribute += $(filter-out $(generated),$(long-m-yes:=.c) $(long-c-yes:=.c)) # Rules for the test suite. tests = test-matherr test-fenv atest-exp atest-sincos atest-exp2 basic-test \ test-misc test-fpucw tst-definitions test-tgmath test-tgmath-ret \ - bug-nextafter bug-nexttoward bug-tgmath1 test-tgmath-int + bug-nextafter bug-nexttoward bug-tgmath1 test-tgmath-int test-tgmath2 # We do the `long double' tests only if this data type is available and # distinct from `double'. test-longdouble-yes = test-ldouble test-ildoubl @@ -129,6 +129,7 @@ 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-tgmath.c = -fno-builtin +CFLAGS-test-tgmath2.c = -fno-builtin CFLAGS-test-tgmath-ret.c = -fno-builtin CPPFLAGS-test-ifloat.c = -U__LIBC_INTERNAL_MATH_INLINES -D__FAST_MATH__ \ -DTEST_FAST_MATH -fno-builtin diff --git a/math/test-tgmath.c b/math/test-tgmath.c index f8453d0835..8ec7fc45d0 100644 --- a/math/test-tgmath.c +++ b/math/test-tgmath.c @@ -1,5 +1,5 @@ /* Test compilation of tgmath macros. - Copyright (C) 2001, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2001, 2003, 2004, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Jakub Jelinek <jakub@redhat.com> and Ulrich Drepper <drepper@redhat.com>, 2001. @@ -37,13 +37,23 @@ static void compile_testl (void); float fx; double dx; long double lx; +const float fy = 1.25; +const double dy = 1.25; +const long double ly = 1.25; +complex float fz; +complex double dz; +complex long double lz; int count_double; int count_float; int count_ldouble; +int count_cdouble; +int count_cfloat; +int count_cldouble; #define NCALLS 115 #define NCALLS_INT 4 +#define NCCALLS 47 int main (void) @@ -51,13 +61,14 @@ main (void) int result = 0; count_float = count_double = count_ldouble = 0; + count_cfloat = count_cdouble = count_cldouble = 0; compile_test (); - if (count_float != 0) + if (count_float != 0 || count_cfloat != 0) { puts ("float function called for double test"); result = 1; } - if (count_ldouble != 0) + if (count_ldouble != 0 || count_cldouble != 0) { puts ("long double function called for double test"); result = 1; @@ -74,15 +85,28 @@ main (void) count_double); result = 1; } + if (count_cdouble < NCCALLS) + { + printf ("double complex functions not called often enough (%d)\n", + count_cdouble); + result = 1; + } + else if (count_cdouble > NCCALLS) + { + printf ("double complex functions called too often (%d)\n", + count_cdouble); + result = 1; + } count_float = count_double = count_ldouble = 0; + count_cfloat = count_cdouble = count_cldouble = 0; compile_testf (); - if (count_double != 0) + if (count_double != 0 || count_cdouble != 0) { puts ("double function called for float test"); result = 1; } - if (count_ldouble != 0) + if (count_ldouble != 0 || count_cldouble != 0) { puts ("long double function called for float test"); result = 1; @@ -98,16 +122,29 @@ main (void) count_double); result = 1; } + if (count_cfloat < NCCALLS) + { + printf ("float complex functions not called often enough (%d)\n", + count_cfloat); + result = 1; + } + else if (count_cfloat > NCCALLS) + { + printf ("float complex functions called too often (%d)\n", + count_cfloat); + result = 1; + } #ifndef NO_LONG_DOUBLE count_float = count_double = count_ldouble = 0; + count_cfloat = count_cdouble = count_cldouble = 0; compile_testl (); - if (count_float != 0) + if (count_float != 0 || count_cfloat != 0) { puts ("float function called for long double test"); result = 1; } - if (count_double != 0) + if (count_double != 0 || count_cdouble != 0) { puts ("double function called for long double test"); result = 1; @@ -124,6 +161,18 @@ main (void) count_double); result = 1; } + if (count_cldouble < NCCALLS) + { + printf ("long double complex functions not called often enough (%d)\n", + count_cldouble); + result = 1; + } + else if (count_cldouble > NCCALLS) + { + printf ("long double complex functions called too often (%d)\n", + count_cldouble); + result = 1; + } #endif return result; @@ -136,20 +185,29 @@ main (void) #define TYPE double #define TEST_INT 1 #define x dx +#define y dy +#define z dz #define count count_double +#define ccount count_cdouble #include "test-tgmath.c" #define F(name) name##f #define TYPE float #define x fx +#define y fy +#define z fz #define count count_float +#define ccount count_cfloat #include "test-tgmath.c" #ifndef NO_LONG_DOUBLE #define F(name) name##l #define TYPE long double #define x lx +#define y ly +#define z lz #define count count_ldouble +#define ccount count_cldouble #include "test-tgmath.c" #endif @@ -165,7 +223,9 @@ static void F(compile_test) (void) { TYPE a, b, c = 1.0; + complex TYPE d; int i; + int saved_count; long int j; long long int k; @@ -228,14 +288,137 @@ F(compile_test) (void) c = fma (i, b, i); a = pow (i, c); #endif + x = a + b + c + i + j + k; + + saved_count = count; + if (ccount != 0) + ccount = -10000; + + d = cos (cos (z)); + z = acos (acos (d)); + d = sin (sin (z)); + z = asin (asin (d)); + d = tan (tan (z)); + z = atan (atan (d)); + d = cosh (cosh (z)); + z = acosh (acosh (d)); + d = sinh (sinh (z)); + z = asinh (asinh (d)); + d = tanh (tanh (z)); + z = atanh (atanh (d)); + d = exp (exp (z)); + z = log (log (d)); + d = sqrt (sqrt (z)); + z = conj (conj (d)); + d = fabs (conj (a)); + z = pow (pow (a, d), pow (b, z)); + d = cproj (cproj (z)); + z += fabs (cproj (a)); + a = carg (carg (z)); + b = creal (creal (d)); + c = cimag (cimag (z)); + x += a + b + c + i + j + k; + z += d; + + if (saved_count != count) + count = -10000; + + if (0) + { + a = cos (y); + a = acos (y); + a = sin (y); + a = asin (y); + a = tan (y); + a = atan (y); + a = atan2 (y, y); + a = cosh (y); + a = acosh (y); + a = sinh (y); + a = asinh (y); + a = tanh (y); + a = atanh (y); + a = exp (y); + a = log (y); + a = log10 (y); + a = ldexp (y, 5); + a = frexp (y, &i); + a = expm1 (y); + a = log1p (y); + a = logb (y); + a = exp2 (y); + a = log2 (y); + a = pow (y, y); + a = sqrt (y); + a = hypot (y, y); + a = cbrt (y); + a = ceil (y); + a = fabs (y); + a = floor (y); + a = fmod (y, y); + a = nearbyint (y); + a = round (y); + a = trunc (y); + a = remquo (y, y, &i); + j = lrint (y) + lround (y); + k = llrint (y) + llround (y); + a = erf (y); + a = erfc (y); + a = tgamma (y); + a = lgamma (y); + a = rint (y); + a = nextafter (y, y); + a = nexttoward (y, y); + a = remainder (y, y); + a = scalb (y, (const TYPE) (6)); + k = scalbn (y, 7) + scalbln (y, 10l); + i = ilogb (y); + a = fdim (y, y); + a = fmax (y, y); + a = fmin (y, y); + a = fma (y, y, y); + +#ifdef TEST_INT + a = atan2 (i, y); + a = remquo (i, y, &i); + a = fma (i, y, i); + a = pow (i, y); +#endif + + d = cos ((const complex TYPE) z); + d = acos ((const complex TYPE) z); + d = sin ((const complex TYPE) z); + d = asin ((const complex TYPE) z); + d = tan ((const complex TYPE) z); + d = atan ((const complex TYPE) z); + d = cosh ((const complex TYPE) z); + d = acosh ((const complex TYPE) z); + d = sinh ((const complex TYPE) z); + d = asinh ((const complex TYPE) z); + d = tanh ((const complex TYPE) z); + d = atanh ((const complex TYPE) z); + d = exp ((const complex TYPE) z); + d = log ((const complex TYPE) z); + d = sqrt ((const complex TYPE) z); + d = pow ((const complex TYPE) z, (const complex TYPE) z); + d = fabs ((const complex TYPE) z); + d = carg ((const complex TYPE) z); + d = creal ((const complex TYPE) z); + d = cimag ((const complex TYPE) z); + d = conj ((const complex TYPE) z); + d = cproj ((const complex TYPE) z); + } } #undef x +#undef y +#undef z TYPE (F(cos)) (TYPE x) { ++count; + P (); return x; } @@ -243,7 +426,7 @@ TYPE (F(acos)) (TYPE x) { ++count; - P(); + P (); return x; } @@ -251,7 +434,7 @@ TYPE (F(sin)) (TYPE x) { ++count; - P(); + P (); return x; } @@ -259,7 +442,7 @@ TYPE (F(asin)) (TYPE x) { ++count; - P(); + P (); return x; } @@ -267,7 +450,7 @@ TYPE (F(tan)) (TYPE x) { ++count; - P(); + P (); return x; } @@ -275,7 +458,7 @@ TYPE (F(atan)) (TYPE x) { ++count; - P(); + P (); return x; } @@ -283,7 +466,7 @@ TYPE (F(atan2)) (TYPE x, TYPE y) { ++count; - P(); + P (); return x + y; } @@ -291,7 +474,7 @@ TYPE (F(cosh)) (TYPE x) { ++count; - P(); + P (); return x; } @@ -299,7 +482,7 @@ TYPE (F(acosh)) (TYPE x) { ++count; - P(); + P (); return x; } @@ -307,7 +490,7 @@ TYPE (F(sinh)) (TYPE x) { ++count; - P(); + P (); return x; } @@ -315,7 +498,7 @@ TYPE (F(asinh)) (TYPE x) { ++count; - P(); + P (); return x; } @@ -323,7 +506,7 @@ TYPE (F(tanh)) (TYPE x) { ++count; - P(); + P (); return x; } @@ -331,7 +514,7 @@ TYPE (F(atanh)) (TYPE x) { ++count; - P(); + P (); return x; } @@ -339,7 +522,7 @@ TYPE (F(exp)) (TYPE x) { ++count; - P(); + P (); return x; } @@ -347,7 +530,7 @@ TYPE (F(log)) (TYPE x) { ++count; - P(); + P (); return x; } @@ -355,7 +538,7 @@ TYPE (F(log10)) (TYPE x) { ++count; - P(); + P (); return x; } @@ -363,23 +546,23 @@ TYPE (F(ldexp)) (TYPE x, int y) { ++count; - P(); - return x; + P (); + return x + y; } TYPE (F(frexp)) (TYPE x, int *y) { ++count; - P(); - return x; + P (); + return x + *y; } TYPE (F(expm1)) (TYPE x) { ++count; - P(); + P (); return x; } @@ -387,7 +570,7 @@ TYPE |
