[Webkit-unassigned] [Bug 27869] New: strict-aliasing warnings in JSFunction.h

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jul 31 00:32:27 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=27869

           Summary: strict-aliasing warnings in JSFunction.h
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: xan.lopez at gmail.com



Xan Lopez <xan.lopez at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #33861|                            |review?
               Flag|                            |


Created an attachment (id=33861)
 --> (https://bugs.webkit.org/attachment.cgi?id=33861)
aliasing.patch

GCC gives me the following warnings when compiling with JSFunction.h:

In file included from ../../JavaScriptCore/runtime/JSFunction.cpp:27,
                 from ../../JavaScriptCore/AllInOneFile.cpp:36:
../../JavaScriptCore/runtime/JSFunction.h: In member function ‘JSC::JSValue (*
JSC::JSFunction::nativeFunction())(JSC::ExecState*, JSC::JSObject*,
JSC::JSValue, const JSC::ArgList&)’:
../../JavaScriptCore/runtime/JSFunction.h:87: warning: dereferencing
type-punned pointer will break strict-aliasing rules
../../JavaScriptCore/runtime/JSFunction.h: In member function ‘JSC::ScopeChain&
JSC::JSFunction::scopeChain()’:
../../JavaScriptCore/runtime/JSFunction.h:104: warning: dereferencing
type-punned pointer will break strict-aliasing rules
../../JavaScriptCore/runtime/JSFunction.h: In member function ‘void
JSC::JSFunction::setScopeChain(const JSC::ScopeChain&)’:
../../JavaScriptCore/runtime/JSFunction.h:119: warning: dereferencing
type-punned pointer will break strict-aliasing rules
../../JavaScriptCore/runtime/JSFunction.h: In member function ‘void
JSC::JSFunction::setNativeFunction(JSC::JSValue (*)(JSC::ExecState*,
JSC::JSObject*, JSC::JSValue, const JSC::ArgList&))’:
../../JavaScriptCore/runtime/JSFunction.h:123: warning: dereferencing
type-punned pointer will break strict-aliasing rules

The problem is that we are accessing a char array as NativeFunction* and
ScopeChain*, which GCC deems to be incompatible pointers. Attached is the usual
trick-solution for this, which is to use a union type and do all memory access
through there. This was done with the help of Maciej on IRC, and he also
suggested that we could do further cleanups here, so I'm attaching my current
patch for discussion.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list