Bug 25864 - strict aliasing issues in WebCore/page/SecurityOriginHash.h
: strict aliasing issues in WebCore/page/SecurityOriginHash.h
Status: RESOLVED WONTFIX
: WebKit
WebCore Misc.
: 528+ (Nightly build)
: PC Linux
: P2 Normal
Assigned To:
:
:
:
:
  Show dependency treegraph
 
Reported: 2009-05-19 09:10 PST by
Modified: 2009-05-19 22:45 PST (History)


Attachments
attempted fix for strict aliasing issue (1.65 KB, patch)
2009-05-19 09:12 PST, Craig Schlenter
eric: review-
Review Patch | Details | Formatted Diff | Diff


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2009-05-19 09:10:08 PST
I've been compiling chromium with gcc 4.4 and I'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'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 'static unsigned int WebCore::SecurityOriginHash::hash(WebCore::SecurityOrigin*)':
/home/craig/chromium.git/src/third_party/WebKit/WebCore/platform/text/StringImpl.h:210: warning: dereferencing pointer 'data' 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 '<anonymous>' does break strict-aliasing rules
/home/craig/chromium.git/src/third_party/WebKit/WebCore/platform/text/StringImpl.h:211: note: initialized from here

I'm attaching a patch which seems to work for me but I have only tested it on linux ... I don't know how other compilers will deal with the union initialisation etc. etc.
------- Comment #1 From 2009-05-19 09:12:43 PST -------
Created an attachment (id=30472) [details]
attempted fix for strict aliasing issue

only tested on linux with gcc 4.4 in chromium
------- Comment #2 From 2009-05-19 09:30:18 PST -------
(From update of attachment 30472 [details])
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)?
------- Comment #3 From 2009-05-19 10:06:44 PST -------
I take Darin's comment to mean that in the interim, we should turn off strict aliasing in Chrome for now.
------- Comment #4 From 2009-05-19 11:06:27 PST -------
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).
------- Comment #5 From 2009-05-19 22:45:08 PST -------
(From update of attachment 30472 [details])
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.
------- Comment #6 From 2009-05-19 22:45:42 PST -------
WONTFIX based on the above comments.  Feel free to open a more general bug about turning on strict aliasing in WebCore.