From b38323d79b6c617edfa25e2aa925da268a9d6905 Mon Sep 17 00:00:00 2001 From: Jeff Genovy <29107334+jefgen@users.noreply.github.com> Date: Thu, 14 Sep 2017 19:09:57 +0000 Subject: [PATCH] ICU-13342 gennorm2 produces incorrect output on MSVC Release builds due to optimizer issues. X-SVN-Rev: 40415 --- icu4c/source/tools/gennorm2/extradata.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/icu4c/source/tools/gennorm2/extradata.cpp b/icu4c/source/tools/gennorm2/extradata.cpp index ae074949d3d..71a39e0fb0d 100644 --- a/icu4c/source/tools/gennorm2/extradata.cpp +++ b/icu4c/source/tools/gennorm2/extradata.cpp @@ -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 -- 2.40.0