summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjocelyn.turcotte@digia.com <jocelyn.turcotte@digia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>2013-02-26 13:01:59 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-01 09:16:29 +0100
commit34983cc93dadd6f1be4f1088ba69d6a060cee15e (patch)
tree652c2a02e1848e94591afee3739ad2837653499d
parent6da40bf3d504020da4394cd2509ad988e5e81ab6 (diff)
downloadqtwebkit-34983cc93dadd6f1be4f1088ba69d6a060cee15e.tar.gz
Work around a MSVC 2012 Update 1 bug causing a crash on x86
https://bugs.webkit.org/show_bug.cgi?id=110488 Reviewed by Anders Carlsson. The crash happens when building with /O2, where TextEncodingNameHash::equal is incorrectly optimized with the inlined toASCIILower and uses a register already in use. The function returns false incorrectly, causing a mismatch of text encoding name which then results in a null pointer access. Slightly rewording the use of the inline function lets the compiler produce correct code. The bug has already been reported and should be fixed in the next release of MSVS later this year. https://connect.microsoft.com/VisualStudio/feedback/details/777533/vs2012-c-optimizing-bug-when-using-inline-and-char-return-type-x86-target-only * platform/text/TextEncodingRegistry.cpp: Task-number: QTBUG-29719 Change-Id: I9fda5528ba3aefcd7c6b6c1042cf3ceb5e325b06 git-svn-id: http://svn.webkit.org/repository/webkit/trunk@144042 268f45cc-cd09-0410-ab3c-d52691b4dbfc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com> Reviewed-by: Iikka Eklund <iikka.eklund@digia.com> Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
-rw-r--r--Source/WebCore/platform/text/TextEncodingRegistry.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/WebCore/platform/text/TextEncodingRegistry.cpp b/Source/WebCore/platform/text/TextEncodingRegistry.cpp
index 2790227fa..6e95a44fe 100644
--- a/Source/WebCore/platform/text/TextEncodingRegistry.cpp
+++ b/Source/WebCore/platform/text/TextEncodingRegistry.cpp
@@ -71,10 +71,19 @@ struct TextEncodingNameHash {
char c1;
char c2;
do {
+#if defined(_MSC_FULL_VER) && _MSC_FULL_VER == 170051106
+ // Workaround for a bug in the VS2012 Update 1 optimizer, remove once the fix is released.
+ // https://connect.microsoft.com/VisualStudio/feedback/details/777533/vs2012-c-optimizing-bug-when-using-inline-and-char-return-type-x86-target-only
+ c1 = toASCIILower(*s1++);
+ c2 = toASCIILower(*s2++);
+ if (c1 != c2)
+ return false;
+#else
c1 = *s1++;
c2 = *s2++;
if (toASCIILower(c1) != toASCIILower(c2))
return false;
+#endif
} while (c1 && c2);
return !c1 && !c2;
}