]> granicus.if.org Git - icu/commitdiff
ICU-13342 gennorm2 produces incorrect output on MSVC Release builds due to optimizer...
authorJeff Genovy <29107334+jefgen@users.noreply.github.com>
Thu, 14 Sep 2017 19:09:57 +0000 (19:09 +0000)
committerJeff Genovy <29107334+jefgen@users.noreply.github.com>
Thu, 14 Sep 2017 19:09:57 +0000 (19:09 +0000)
X-SVN-Rev: 40415

icu4c/source/tools/gennorm2/extradata.cpp

index ae074949d3da07afc4c937d4b50a13e669d08027..71a39e0fb0d9844c66a07d2016d0c55b36db95f6 100644 (file)
@@ -23,7 +23,7 @@
 
 U_NAMESPACE_BEGIN
 
-ExtraData::ExtraData(Norms &n, UBool fast) :
+ExtraData::ExtraData(Norms & n, UBool fast) :
         Norms::Enumerator(n),
         yesYesCompositions(1000, (UChar32)0xffff, 2),  // 0=inert, 1=Jamo L, 2=start of compositions
         yesNoMappingsAndCompositions(1000, (UChar32)0, 1),  // 0=Hangul LV, 1=start of normal data
@@ -186,6 +186,11 @@ void ExtraData::rangeHandler(UChar32 start, UChar32 end, Norm &norm) {
     writeExtraData(start, norm);
 }
 
+//  Ticket #13342 - Disable optimizations on MSVC for this function as a workaround.
+#if (defined(_MSC_VER) && (_MSC_VER >= 1900) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 190024210))
+#pragma optimize( "", off )
+#endif
+
 void ExtraData::writeExtraData(UChar32 c, Norm &norm) {
     switch(norm.type) {
     case Norm::INERT:
@@ -238,6 +243,11 @@ void ExtraData::writeExtraData(UChar32 c, Norm &norm) {
     }
 }
 
+// Ticket #13342 - Turn optimization back on.
+#if (defined(_MSC_VER) && (_MSC_VER >= 1900) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 190024210))
+#pragma optimize( "", on )
+#endif
+
 U_NAMESPACE_END
 
 #endif // #if !UCONFIG_NO_NORMALIZATION