Resolves: rhbz#596171 aliasing issues

This commit is contained in:
Caolan McNamara 2010-05-26 13:53:33 +00:00
parent 93e640133a
commit 38b7060571
3 changed files with 12 additions and 151 deletions

View File

@ -1,12 +0,0 @@
diff -ru icu.orig/source/configure.in icu/source/configure.in
--- icu.orig/source/configure.in 2009-09-01 08:56:46.000000000 +0100
+++ icu/source/configure.in 2009-09-01 10:38:25.000000000 +0100
@@ -462,7 +462,7 @@
# Check to see if genccode can generate simple assembly.
GENCCODE_ASSEMBLY=
case "${host}" in
-i*86-*-linux*|x86_64-*-linux*|powerpc*-*-linux*|i*86-*-*bsd*|i*86-pc-gnu)
+*-linux*|i*86-*-*bsd*|i*86-pc-gnu)
if test "$GCC" = yes; then
# We're using gcc, and the simple -a gcc command line works for genccode
GENCCODE_ASSEMBLY="-a gcc"

View File

@ -1,132 +0,0 @@
diff -ru icu.orig/source/common/putil.c icu/source/common/putil.c
--- icu.orig/source/common/putil.c 2008-08-26 13:12:58.000000000 +0100
+++ icu/source/common/putil.c 2008-08-26 13:13:01.000000000 +0100
@@ -160,30 +160,46 @@
# define U_POSIX_LOCALE 1
#endif
-/*
- WARNING! u_topNBytesOfDouble and u_bottomNBytesOfDouble
- can't be properly optimized by the gcc compiler sometimes (i.e. gcc 3.2).
-*/
#if !IEEE_754
-static char*
-u_topNBytesOfDouble(double* d, int n)
+static uint32_t
+u_topOfDoubleAsUint32(double d)
{
-#if U_IS_BIG_ENDIAN
- return (char*)d;
-#else
- return (char*)(d + 1) - n;
-#endif
+ union
+ {
+ double d;
+ uint32_t i[2];
+ } u;
+
+ u.d = d;
+ return u.i
+ [
+# if U_IS_BIG_ENDIAN
+ 0
+# else
+ 1
+# endif
+ ];
}
#endif
-static char*
-u_bottomNBytesOfDouble(double* d, int n)
+static uint32_t
+u_bottomOfDoubleAsUint32(double d)
{
-#if U_IS_BIG_ENDIAN
- return (char*)(d + 1) - n;
-#else
- return (char*)d;
-#endif
+ union
+ {
+ double d;
+ uint32_t i[2];
+ } u;
+
+ u.d = d;
+ return u.i
+ [
+# if U_IS_BIG_ENDIAN
+ 1
+# else
+ 0
+# endif
+ ];
}
#if defined (U_DEBUG_FAKETIME)
@@ -297,10 +313,8 @@
return (UBool)((convertedNumber.i64 & U_INT64_MAX) > gInf.i64);
#elif defined(OS390)
- uint32_t highBits = *(uint32_t*)u_topNBytesOfDouble(&number,
- sizeof(uint32_t));
- uint32_t lowBits = *(uint32_t*)u_bottomNBytesOfDouble(&number,
- sizeof(uint32_t));
+ uint32_t highBits = u_topOfDoubleAsUint32(number);
+ uint32_t lowBits = u_bottomOfDoubleAsUint32(number);
return ((highBits & 0x7F080000L) == 0x7F080000L) &&
(lowBits == 0x00000000L);
@@ -322,10 +336,8 @@
/* Infinity is exactly 0x7FF0000000000000U. */
return (UBool)((convertedNumber.i64 & U_INT64_MAX) == gInf.i64);
#elif defined(OS390)
- uint32_t highBits = *(uint32_t*)u_topNBytesOfDouble(&number,
- sizeof(uint32_t));
- uint32_t lowBits = *(uint32_t*)u_bottomNBytesOfDouble(&number,
- sizeof(uint32_t));
+ uint32_t highBits = u_topOfDoubleAsUint32(number);
+ uint32_t lowBits = u_bottomOfDoubleAsUint32(number);
return ((highBits & ~SIGN) == 0x70FF0000L) && (lowBits == 0x00000000L);
@@ -354,8 +366,7 @@
return (UBool)(number < 0 && uprv_isInfinite(number));
#else
- uint32_t highBits = *(uint32_t*)u_topNBytesOfDouble(&number,
- sizeof(uint32_t));
+ uint32_t highBits = u_topOfDoubleAsUint32(number);
return((highBits & SIGN) && uprv_isInfinite(number));
#endif
@@ -447,7 +458,7 @@
return uprv_getNaN();
/* check for -0 and 0*/
- lowBits = *(uint32_t*) u_bottomNBytesOfDouble(&x, sizeof(uint32_t));
+ lowBits = u_bottomOfDoubleAsUint32(x);
if(x == 0.0 && y == 0.0 && (lowBits & SIGN))
return y;
@@ -468,7 +479,7 @@
return uprv_getNaN();
/* check for -0 and 0*/
- lowBits = *(uint32_t*) u_bottomNBytesOfDouble(&y, sizeof(uint32_t));
+ lowBits = u_bottomOfDoubleAsUint32(y);
if(x == 0.0 && y == 0.0 && (lowBits & SIGN))
return y;
@@ -497,7 +508,7 @@
if(uprv_isInfinite(d))
return uprv_getInfinity();
- lowBits = *(uint32_t*) u_bottomNBytesOfDouble(&d, sizeof(uint32_t));
+ lowBits = u_bottomOfDoubleAsUint32(d);
if( (d == 0.0 && (lowBits & SIGN)) || d < 0)
return ceil(d);
else
Only in icu/source/common: putil.c.orig

View File

@ -1,6 +1,6 @@
Name: icu Name: icu
Version: 4.4.1 Version: 4.4.1
Release: 1%{?dist} Release: 2%{?dist}
Summary: International Components for Unicode Summary: International Components for Unicode
Group: Development/Tools Group: Development/Tools
License: MIT and UCD and Public Domain License: MIT and UCD and Public Domain
@ -12,9 +12,8 @@ BuildRequires: doxygen, autoconf
Requires: lib%{name} = %{version}-%{release} Requires: lib%{name} = %{version}-%{release}
Patch1: icu-3.4-multiarchdevel.patch Patch1: icu-3.4-multiarchdevel.patch
Patch2: icu.icu6284.strictalias.patch Patch2: icu.6995.kannada.patch
Patch3: icu.6995.kannada.patch Patch3: icu.XXXX.buildfix.patch
Patch4: icu.XXXX.buildfix.patch
%description %description
Tools and utilities for developing with icu. Tools and utilities for developing with icu.
@ -55,13 +54,14 @@ BuildArch: noarch
%prep %prep
%setup -q -n %{name} %setup -q -n %{name}
%patch1 -p1 -b .multiarchdevel %patch1 -p1 -b .multiarchdevel
%patch2 -p1 -b .icu6284.strictalias.patch %patch2 -p1 -b .icu6995.kannada.patch
%patch3 -p1 -b .icu6995.kannada.patch %patch3 -p1 -b .icuXXXX.buildfix.patch
%patch4 -p1 -b .icuXXXX.buildfix.patch
%build %build
cd source cd source
autoconf autoconf
CFLAGS='%optflags -fno-strict-aliasing'
CXXFLAGS='%optflags -fno-strict-aliasing'
%configure --with-data-packaging=library --disable-samples %configure --with-data-packaging=library --disable-samples
#rhbz#225896 #rhbz#225896
sed -i -- "s/-nodefaultlibs -nostdlib//" config/mh-linux sed -i -- "s/-nodefaultlibs -nostdlib//" config/mh-linux
@ -136,6 +136,11 @@ rm -rf $RPM_BUILD_ROOT
%doc source/__docs/%{name}/html/* %doc source/__docs/%{name}/html/*
%changelog %changelog
* Wed May 26 2010 Caolan McNamara <caolanm@redhat.com> - 4.4.1-2
- Resolves: rhbz#596171 drop icu.icu6284.strictalias.patch and use
-fno-strict-aliasig as upstream has added a pile more and doesn't look
interested in proposed patchs
* Thu Apr 29 2010 Caolan McNamara <caolanm@redhat.com> - 4.4.1-1 * Thu Apr 29 2010 Caolan McNamara <caolanm@redhat.com> - 4.4.1-1
- latest version - latest version
- drop integrated icu.icu7567.libctest.patch - drop integrated icu.icu7567.libctest.patch