]> granicus.if.org Git - icu/commitdiff
ICU-20001 Adding alignas to static-allocated memory.
authorShane <sffc@sffc1.com>
Thu, 16 Aug 2018 02:01:10 +0000 (21:01 -0500)
committerShane Carr <shane@unicode.org>
Thu, 27 Sep 2018 21:27:38 +0000 (14:27 -0700)
Should fix possible crashes on ARM platforms. (#63)

icu4c/source/common/static_unicode_sets.cpp
icu4c/source/i18n/number_decimfmtprops.cpp

index 9e731f5781e2153bee4f849487c4cf24008a5ed2..5d598a0e33b6d46be0f650539d4c4dccde0e63de 100644 (file)
@@ -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.
index 6754fe19eca56cffbc6861ffd7d1fefed40eb4ab..12fe7060e2d051286e95555dd19266bf7538f8c3 100644 (file)
@@ -15,6 +15,7 @@ using namespace icu::number::impl;
 
 namespace {
 
+alignas(DecimalFormatProperties)
 char kRawDefaultProperties[sizeof(DecimalFormatProperties)];
 
 icu::UInitOnce gDefaultPropertiesInitOnce = U_INITONCE_INITIALIZER;