Verified Commit 1891df11 authored by A. Wilcox's avatar A. Wilcox

system/icu: fix test failure on 32-bit; resolves #88

parent dacd791b
......@@ -18,6 +18,7 @@ makedepends=""
source="https://download.icu-project.org/files/icu4c/${pkgver}/${pkgname}4c-$_ver-src.tgz
icu-60.2-always-use-utf8.patch
checkimpl.patch
icu-63.1-test-failure.patch
"
# secfixes:
......@@ -87,4 +88,5 @@ static() {
sha512sums="9ab407ed840a00cdda7470dcc4c40299a125ad246ae4d019c4b1ede54781157fd63af015a8228cd95dbc47e4d15a0932b2c657489046a19788e5e8266eac079c icu4c-63_1-src.tgz
f86c62422f38f6485c58d4766e629bab69e4b0e00fa910854e40e7db1ace299152eaefa99ae2fbab7465e65d3156cbea7124612defa60680db58ab5c34d6262f icu-60.2-always-use-utf8.patch
af27a474af041a6ac522901a635c3f328dee5f2b8e42d1229970908c740cd2b97fc06e5432541773d7c80339382f75d795911540f844b6d89ec0ee99d4fa6ff9 checkimpl.patch"
af27a474af041a6ac522901a635c3f328dee5f2b8e42d1229970908c740cd2b97fc06e5432541773d7c80339382f75d795911540f844b6d89ec0ee99d4fa6ff9 checkimpl.patch
24a64f05e10b59d2f7fdd063e032195d446c668497934a0f5012a7b6088b61d260f7ddb8ecbe60bdc49e16ab810fda169bc1d330f30acdf45a1ad8f844fc464d icu-63.1-test-failure.patch"
From 0da942bd52ffdd3621689fbc4bf3017e75b001e3 Mon Sep 17 00:00:00 2001
From: Fredrik Roubert <roubert@google.com>
Date: Fri, 12 Oct 2018 14:33:03 +0200
Subject: [PATCH] ICU-20080 Avoid strange compiler behaviour in ASSERT_EQUAL()
macro.
Using temporary variables for the two values to be compared here makes
GCC compile the code just like we expect it to. (What it really is that
it otherwise does on some architechtures remains a mystery.)
This will make the tests pass as expected also on IA-32 with GCC.
It'll also make it possible to revert the old workaround for SPARC
introduced by commit 5b0592af79c7601d08cafcbbc7b71077faeb7e4f.
Tested:
Linux gcc45 3.16.0-5-686-pae #1 SMP Debian 3.16.51-3+deb8u1 (2018-01-08) i686 GNU/Linux
Debian clang version 3.5.0-10 (tags/RELEASE_350/final) (based on LLVM 3.5.0)
g++ (Debian 4.9.2-10+deb8u1) 4.9.2
Linux gcc202 4.16.0-1-sparc64-smp #1 SMP Debian 4.16.5-1 (2018-04-29) sparc64 GNU/Linux
clang version 4.0.1-10+sparc64 (tags/RELEASE_401/final)
g++ (Debian 8.2.0-7) 8.2.0
---
icu4c/source/test/intltest/dcfmapts.cpp | 21 +++++++++------------
1 file changed, 9 insertions(+), 12 deletions(-)
diff --git a/icu4c/source/test/intltest/dcfmapts.cpp b/icu4c/source/test/intltest/dcfmapts.cpp
index 6a79bab8509..9fa0e3deee4 100644
--- source/test/intltest/dcfmapts.cpp
+++ source/test/intltest/dcfmapts.cpp
@@ -636,8 +636,14 @@ void IntlTestDecimalFormatAPI::TestScale()
}
-#define ASSERT_EQUAL(expect, actual) { char tmp[200]; sprintf(tmp, "(%g==%g)", (double)(expect), (double)(actual)); \
- assertTrue(tmp, ((expect)==(actual)), FALSE, TRUE, __FILE__, __LINE__); }
+#define ASSERT_EQUAL(expect, actual) { \
+ /* ICU-20080: Use temporary variables to avoid strange compiler behaviour \
+ (with the nice side-effect of avoiding repeated function calls too). */ \
+ auto lhs = (expect); \
+ auto rhs = (actual); \
+ char tmp[200]; \
+ sprintf(tmp, "(%g==%g)", (double)lhs, (double)rhs); \
+ assertTrue(tmp, (lhs==rhs), FALSE, TRUE, __FILE__, __LINE__); }
void IntlTestDecimalFormatAPI::TestFixedDecimal() {
UErrorCode status = U_ZERO_ERROR;
@@ -946,16 +952,7 @@ void IntlTestDecimalFormatAPI::TestFixedDecimal() {
ASSERT_EQUAL(0, fd.getPluralOperand(PLURAL_OPERAND_T));
// note: going through DigitList path to FixedDecimal, which is trimming
// int64_t fields to 18 digits. See ticket Ticket #10374
- // ASSERT_EQUAL(223372036854775807LL, fd.getPluralOperand(PLURAL_OPERAND_I);
- if (!(
- fd.getPluralOperand(PLURAL_OPERAND_I) == 223372036854775807LL ||
- fd.getPluralOperand(PLURAL_OPERAND_I) == 9223372036854775807LL)) {
- dataerrln(
- "File %s, Line %d, fd.getPluralOperand(PLURAL_OPERAND_I = %lld",
- __FILE__,
- __LINE__,
- fd.getPluralOperand(PLURAL_OPERAND_I));
- }
+ ASSERT_EQUAL(223372036854775807LL, fd.getPluralOperand(PLURAL_OPERAND_I));
ASSERT_EQUAL(TRUE, fd.hasIntegerValue());
ASSERT_EQUAL(FALSE, fd.isNegative());
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment