From 59b24d359e79c9c56ef1a3581b648326358c36f4 Mon Sep 17 00:00:00 2001 From: archie Date: Thu, 19 Sep 2002 19:47:27 +0000 Subject: Fix a problem with the definition of HUGE_VAL causing the gcc warning "cast increases required alignment of target type" on some platforms. Reviewed by: bde --- lib/libc/alpha/gen/infinity.c | 2 +- lib/libc/amd64/gen/infinity.c | 2 +- lib/libc/i386/gen/infinity.c | 2 +- lib/libc/ia64/gen/infinity.c | 2 +- lib/libc/sparc64/gen/infinity.c | 2 +- lib/msun/src/math.h | 7 +++++-- 6 files changed, 10 insertions(+), 7 deletions(-) (limited to 'lib') diff --git a/lib/libc/alpha/gen/infinity.c b/lib/libc/alpha/gen/infinity.c index 7cb5b80..15b1293 100644 --- a/lib/libc/alpha/gen/infinity.c +++ b/lib/libc/alpha/gen/infinity.c @@ -33,4 +33,4 @@ __FBSDID("$FreeBSD$"); #include /* bytes for +Infinity on an Alpha (IEEE double format) */ -char __infinity[] = { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }; +const union __infinity_un __infinity = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } }; diff --git a/lib/libc/amd64/gen/infinity.c b/lib/libc/amd64/gen/infinity.c index 966a06e..547927b 100644 --- a/lib/libc/amd64/gen/infinity.c +++ b/lib/libc/amd64/gen/infinity.c @@ -8,4 +8,4 @@ __FBSDID("$FreeBSD$"); #include /* bytes for +Infinity on a 387 */ -char __infinity[] = { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }; +const union __infinity_un __infinity = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } }; diff --git a/lib/libc/i386/gen/infinity.c b/lib/libc/i386/gen/infinity.c index 966a06e..547927b 100644 --- a/lib/libc/i386/gen/infinity.c +++ b/lib/libc/i386/gen/infinity.c @@ -8,4 +8,4 @@ __FBSDID("$FreeBSD$"); #include /* bytes for +Infinity on a 387 */ -char __infinity[] = { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }; +const union __infinity_un __infinity = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } }; diff --git a/lib/libc/ia64/gen/infinity.c b/lib/libc/ia64/gen/infinity.c index a24cea8..681d811 100644 --- a/lib/libc/ia64/gen/infinity.c +++ b/lib/libc/ia64/gen/infinity.c @@ -33,4 +33,4 @@ __FBSDID("$FreeBSD$"); #include /* bytes for +Infinity on an ia64 (IEEE double format) */ -char __infinity[] = { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }; +const union __infinity_un __infinity = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } }; diff --git a/lib/libc/sparc64/gen/infinity.c b/lib/libc/sparc64/gen/infinity.c index 3a5cd47..4a04c1c 100644 --- a/lib/libc/sparc64/gen/infinity.c +++ b/lib/libc/sparc64/gen/infinity.c @@ -11,4 +11,4 @@ __FBSDID("$FreeBSD$"); #include /* bytes for +Infinity on a sparc */ -char __infinity[] = { 0x7f, (char)0xf0, 0, 0, 0, 0, 0, 0 }; +const union __infinity_un __infinity = { { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } }; diff --git a/lib/msun/src/math.h b/lib/msun/src/math.h index 108b086..5f7312b 100644 --- a/lib/msun/src/math.h +++ b/lib/msun/src/math.h @@ -20,8 +20,11 @@ /* * ANSI/POSIX */ -extern char __infinity[]; -#define HUGE_VAL (*(double *) __infinity) +extern const union __infinity_un { + unsigned char __uc[8]; + double __ud; +} __infinity; +#define HUGE_VAL (__infinity.__ud) /* * XOPEN/SVID -- cgit v1.1