Title: [144042] trunk/Source/WebCore
Revision
144042
Author
[email protected]
Date
2013-02-26 05:01:59 -0800 (Tue, 26 Feb 2013)

Log Message

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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (144041 => 144042)


--- trunk/Source/WebCore/ChangeLog	2013-02-26 12:52:33 UTC (rev 144041)
+++ trunk/Source/WebCore/ChangeLog	2013-02-26 13:01:59 UTC (rev 144042)
@@ -1,3 +1,22 @@
+2013-02-26  Jocelyn Turcotte  <[email protected]>
+
+        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:
+
 2013-02-01  Andrey Kosyakov  <[email protected]>
 
         Web Inspector: plumb trace events to Timeline agent

Modified: trunk/Source/WebCore/platform/text/TextEncodingRegistry.cpp (144041 => 144042)


--- trunk/Source/WebCore/platform/text/TextEncodingRegistry.cpp	2013-02-26 12:52:33 UTC (rev 144041)
+++ trunk/Source/WebCore/platform/text/TextEncodingRegistry.cpp	2013-02-26 13:01:59 UTC (rev 144042)
@@ -65,10 +65,19 @@
         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;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to