Reviewers: Mads Ager,

Description:
Fix a strict aliasing bug in x64 release build.

When this function is fully inlined in a release build, the assignment
to *result is reorder after the read. Thus the rest of the code ends
up using the wrong value and crashes shortly after.

Please review this at http://codereview.chromium.org/164437

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
   M     src/handles.h


Index: src/handles.h
===================================================================
--- src/handles.h       (revision 2670)
+++ src/handles.h       (working copy)
@@ -126,7 +126,7 @@
      // handle, and return the result.
      ASSERT(result < current_.limit);
      current_.next = result + 1;
-    *reinterpret_cast<Object**>(result) = value;
+    memcpy(result, &value, sizeof(value));
      return reinterpret_cast<Object**>(result);
    }




--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to