From: Shane Date: Thu, 16 Aug 2018 02:01:10 +0000 (-0500) Subject: ICU-20001 Adding alignas to static-allocated memory. X-Git-Tag: release-63-rc~114 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3420d5a55b073e9110318f0b0f9397d186ab77eb;p=icu ICU-20001 Adding alignas to static-allocated memory. Should fix possible crashes on ARM platforms. (#63) --- 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;