From e5501bdb46ed02bf20b41d2303a8e2337bf30d22 Mon Sep 17 00:00:00 2001 From: Shane Date: Wed, 15 Aug 2018 21:01:10 -0500 Subject: [PATCH] ICU-20001 Adding alignas to static-allocated memory. Should fix possible crashes on ARM platforms. (#63) --- icu4c/source/common/static_unicode_sets.cpp | 1 + icu4c/source/i18n/number_decimfmtprops.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/icu4c/source/common/static_unicode_sets.cpp b/icu4c/source/common/static_unicode_sets.cpp index 9e731f5781e..5d598a0e33b 100644 --- a/icu4c/source/common/static_unicode_sets.cpp +++ b/icu4c/source/common/static_unicode_sets.cpp @@ -27,6 +27,7 @@ UnicodeSet* gUnicodeSets[COUNT] = {}; // Save the empty instance in static memory to have well-defined behavior if a // regular UnicodeSet cannot be allocated. +alignas(UnicodeSet) char gEmptyUnicodeSet[sizeof(UnicodeSet)]; // Whether the gEmptyUnicodeSet is initialized and ready to use. diff --git a/icu4c/source/i18n/number_decimfmtprops.cpp b/icu4c/source/i18n/number_decimfmtprops.cpp index 6754fe19eca..12fe7060e2d 100644 --- a/icu4c/source/i18n/number_decimfmtprops.cpp +++ b/icu4c/source/i18n/number_decimfmtprops.cpp @@ -15,6 +15,7 @@ using namespace icu::number::impl; namespace { +alignas(DecimalFormatProperties) char kRawDefaultProperties[sizeof(DecimalFormatProperties)]; icu::UInitOnce gDefaultPropertiesInitOnce = U_INITONCE_INITIALIZER;