add icu.icu6284.strictalias.patch

This commit is contained in:
Caolan McNamara 2008-05-19 14:01:54 +00:00
parent 01500e67f5
commit c954b5b534
2 changed files with 137 additions and 3 deletions

View File

@ -0,0 +1,130 @@
--- icu.orig/source/common/putil.c 2008-05-19 13:33:04.000000000 +0100
+++ icu/source/common/putil.c 2008-05-19 14:18:15.000000000 +0100
@@ -159,30 +159,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_WINDOWS)
@@ -259,10 +274,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);
@@ -284,10 +297,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);
@@ -316,8 +327,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
@@ -409,7 +419,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;
@@ -430,7 +440,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;
@@ -459,7 +469,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

View File

@ -1,6 +1,6 @@
Name: icu
Version: 3.8.1
Release: 7%{?dist}
Release: 8%{?dist}
Summary: International Components for Unicode
Group: Development/Tools
License: MIT
@ -21,6 +21,7 @@ Patch9: icu.icu6008.arm.padding.patch
Patch10: icu.icu5498.openoffice.org.patch
Patch11: icu.regexp.patch
Patch12: icu.icu6213.worstcase.patch
Patch13: icu.icu6284.strictalias.patch
%description
Tools and utilities for developing with icu.
@ -70,11 +71,10 @@ Group: Documentation
%patch10 -p1 -b .icu5498.openoffice.org.patch
%patch11 -p0 -b .regexp.patch
%patch12 -p1 -b .icu6213.worstcase.patch
%patch13 -p1 -b .icu6284.strictalias.patch
%build
cd source
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
export CXXFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
autoconf
%configure --with-data-packaging=library --disable-samples
make # %{?_smp_mflags} # -j(X>1) may "break" man pages as of 3.2, b.f.u #2357
@ -147,6 +147,10 @@ rm -rf $RPM_BUILD_ROOT
%doc source/__docs/%{name}/html/*
%changelog
* Mon May 19 2008 Caolan McNamara <caolanm@redhat.com> - 3.8.1-8
- add icu.icu6284.strictalias.patch and build with
strict-aliasing
* Tue Mar 18 2008 Caolan McNamara <caolanm@redhat.com> - 3.8.1-7
- Resolves: rhbz#437761 modify to icu.icu6213.worstcase.patch for
other worst case expansions