<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>25864</bug_id>
          
          <creation_ts>2009-05-19 09:10:08 -0700</creation_ts>
          <short_desc>strict aliasing issues in WebCore/page/SecurityOriginHash.h</short_desc>
          <delta_ts>2009-05-19 22:45:42 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WONTFIX</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Craig Schlenter">craig.schlenter</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>121916</commentid>
    <comment_count>0</comment_count>
    <who name="Craig Schlenter">craig.schlenter</who>
    <bug_when>2009-05-19 09:10:08 -0700</bug_when>
    <thetext>I&apos;ve been compiling chromium with gcc 4.4 and I&apos;ve had to use -fno-strict-aliasing for webkit due to a couple of issues. The code in question should be equivalent to that in WebKit itself. Here&apos;s one of the issues:

In file included from /home/craig/chromium.git/src/third_party/WebKit/WebCore/storage/OriginQuotaManager.h:35,
                 from /home/craig/chromium.git/src/third_party/WebKit/WebCore/storage/DatabaseTracker.cpp:40:
/home/craig/chromium.git/src/third_party/WebKit/WebCore/platform/text/StringImpl.h: In static member function &apos;static unsigned int WebCore::SecurityOriginHash::hash(WebCore::SecurityOrigin*)&apos;:
/home/craig/chromium.git/src/third_party/WebKit/WebCore/platform/text/StringImpl.h:210: warning: dereferencing pointer &apos;data&apos; does break strict-aliasing rules
/home/craig/chromium.git/src/third_party/WebKit/WebCore/page/SecurityOriginHash.h:46: note: initialized from here
/home/craig/chromium.git/src/third_party/WebKit/WebCore/platform/text/StringImpl.h:213: note: initialized from here
/home/craig/chromium.git/src/third_party/WebKit/WebCore/platform/text/StringImpl.h:211: warning: dereferencing pointer &apos;&lt;anonymous&gt;&apos; does break strict-aliasing rules
/home/craig/chromium.git/src/third_party/WebKit/WebCore/platform/text/StringImpl.h:211: note: initialized from here

I&apos;m attaching a patch which seems to work for me but I have only tested it on linux ... I don&apos;t know how other compilers will deal with the union initialisation etc. etc.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>121917</commentid>
    <comment_count>1</comment_count>
      <attachid>30472</attachid>
    <who name="Craig Schlenter">craig.schlenter</who>
    <bug_when>2009-05-19 09:12:43 -0700</bug_when>
    <thetext>Created attachment 30472
attempted fix for strict aliasing issue

only tested on linux with gcc 4.4 in chromium</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>121923</commentid>
    <comment_count>2</comment_count>
      <attachid>30472</attachid>
    <who name="Darin Adler">darin</who>
    <bug_when>2009-05-19 09:30:18 -0700</bug_when>
    <thetext>Comment on attachment 30472
attempted fix for strict aliasing issue

In the past, WebCore has not been compiled with strict aliasing turned on. Unlike JavaScriptCore, where we fixed all the strict aliasing issues.

I would expect many, many problems in WebCore. Not just warnings, but actual code generation problems. Do we really want to do this project (turning on strict aliasing in WebCore)?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>121932</commentid>
    <comment_count>3</comment_count>
    <who name="Evan Martin">evan</who>
    <bug_when>2009-05-19 10:06:44 -0700</bug_when>
    <thetext>I take Darin&apos;s comment to mean that in the interim, we should turn off strict aliasing in Chrome for now.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>121940</commentid>
    <comment_count>4</comment_count>
    <who name="Peter Kasting">pkasting</who>
    <bug_when>2009-05-19 11:06:27 -0700</bug_when>
    <thetext>Over time we should definitely fix strict aliasing problems.  GCC is not the only compiler where they can cause issues.  Generally they are easy to fix by adding unions (I would probably elect to use more typedefs in the particular patch above for clarity, though).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122069</commentid>
    <comment_count>5</comment_count>
      <attachid>30472</attachid>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2009-05-19 22:45:08 -0700</bug_when>
    <thetext>Comment on attachment 30472
attempted fix for strict aliasing issue

bug 16317 is another way to make this code cleaner.  But given the above comments, I think we should close this and someone who is interested in turning on strict aliasing warnings for WebCore can do this for real later.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122070</commentid>
    <comment_count>6</comment_count>
    <who name="Eric Seidel (no email)">eric</who>
    <bug_when>2009-05-19 22:45:42 -0700</bug_when>
    <thetext>WONTFIX based on the above comments.  Feel free to open a more general bug about turning on strict aliasing in WebCore.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>30472</attachid>
            <date>2009-05-19 09:12:43 -0700</date>
            <delta_ts>2009-05-19 22:45:08 -0700</delta_ts>
            <desc>attempted fix for strict aliasing issue</desc>
            <filename>securityoriginhash.patch</filename>
            <type>text/plain</type>
            <size>1686</size>
            <attacher name="Craig Schlenter">craig.schlenter</attacher>
            
              <data encoding="base64">SW5kZXg6IFdlYkNvcmUvQ2hhbmdlTG9nCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIFdlYkNvcmUvQ2hhbmdlTG9n
CShyZXZpc2lvbiA0Mzg1OCkKKysrIFdlYkNvcmUvQ2hhbmdlTG9nCSh3b3JraW5nIGNvcHkpCkBA
IC0xLDMgKzEsMTMgQEAKKzIwMDktMDUtMTk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aXMgaXMgcGFpbmZ1bCBidXQgaXQg
YXZvaWRzIGdjYyA0LjQgc3RyaWN0IGFsaWFzaW5nIGlzc3Vlcy4KKyAgICAgICAgdW5pb24gewor
ICAgICAgICAgICAgdW5zaWduZWQgdVszXTsKKyAgICAgICAgICAgIFVDaGFyIHVjWygzICogc2l6
ZW9mKHVuc2lnbmVkKSkvc2l6ZW9mKFVDaGFyKV07CisgICAgICAgIH0gaGFzaENvZGVzID0ge3sK
ICAgICAgICAgICAgIG9yaWdpbi0+cHJvdG9jb2woKS5pbXBsKCkgPyBvcmlnaW4tPnByb3RvY29s
KCkuaW1wbCgpLT5oYXNoKCkgOiAwLAogICAgICAgICAgICAgb3JpZ2luLT5ob3N0KCkuaW1wbCgp
ID8gb3JpZ2luLT5ob3N0KCkuaW1wbCgpLT5oYXNoKCkgOiAwLAogICAgICAgICAgICAgb3JpZ2lu
LT5wb3J0KCkKLSAgICAgICAgfTsKLSAgICAgICAgcmV0dXJuIFN0cmluZ0ltcGw6OmNvbXB1dGVI
YXNoKHJlaW50ZXJwcmV0X2Nhc3Q8VUNoYXIqPihoYXNoQ29kZXMpLCBzaXplb2YoaGFzaENvZGVz
KSAvIHNpemVvZihVQ2hhcikpOworICAgICAgICB9fTsKKyAgICAgICAgcmV0dXJuIFN0cmluZ0lt
cGw6OmNvbXB1dGVIYXNoKGhhc2hDb2Rlcy51Yywgc2l6ZW9mKGhhc2hDb2Rlcy51YykgLyBzaXpl
b2YoVUNoYXIpKTsKICAgICB9CiAgICAgc3RhdGljIHVuc2lnbmVkIGhhc2goY29uc3QgUmVmUHRy
PFNlY3VyaXR5T3JpZ2luPiYgb3JpZ2luKQogICAgIHsK
</data>
<flag name="review"
          id="15378"
          type_id="1"
          status="-"
          setter="eric"
    />
          </attachment>
      

    </bug>

</bugzilla>