Bug 77422

Summary: Fix type punning warning in HashTable.h debug builds
Product: WebKit Reporter: Andy Wingo <wingo>
Component: Web Template FrameworkAssignee: Andy Wingo <wingo>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, aroben, barraclough, darin, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Andy Wingo
Reported 2012-01-31 03:48:31 PST
The patch to be attached fixes warnings like this one: ../../Source/JavaScriptCore/API/JSObjectRef.cpp:548:1: instantiated from here ../../Source/JavaScriptCore/wtf/HashTable.h:481:90: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] Why does it work, you ask? That, dear sir or madam, I do not know.
Attachments
Patch (1.58 KB, patch)
2012-01-31 03:50 PST, Andy Wingo
no flags
Andy Wingo
Comment 1 2012-01-31 03:50:10 PST
WebKit Review Bot
Comment 2 2012-01-31 03:51:53 PST
Attachment 124704 [details] did not pass style-queue: Failed to run "['Tools/Scripts/update-webkit']" exit_code: 9 Updating OpenSource First, rewinding head to replay your work on top of it... Applying: Fix compilation errors on build-webkit --debug --no-workers on mac. Using index info to reconstruct a base tree... Falling back to patching base and 3-way merge... Auto-merging LayoutTests/ChangeLog CONFLICT (content): Merge conflict in LayoutTests/ChangeLog Auto-merging LayoutTests/platform/qt/Skipped CONFLICT (content): Merge conflict in LayoutTests/platform/qt/Skipped Auto-merging Source/WebCore/ChangeLog CONFLICT (content): Merge conflict in Source/WebCore/ChangeLog Failed to merge in the changes. Patch failed at 0001 Fix compilation errors on build-webkit --debug --no-workers on mac. When you have resolved this problem run "git rebase --continue". If you would prefer to skip this patch, instead run "git rebase --skip". To restore the original branch and stop rebasing run "git rebase --abort". rebase refs/remotes/origin/master: command returned error: 1 Died at Tools/Scripts/update-webkit line 164. If any of these errors are false positives, please file a bug against check-webkit-style.
Andy Wingo
Comment 3 2012-01-31 04:01:35 PST
(In reply to comment #2) > Falling back to patching base and 3-way merge... > Auto-merging LayoutTests/ChangeLog My patch does not touch this file. What's up with that? Andy
Andy Wingo
Comment 4 2012-01-31 04:04:22 PST
Adding Darin and Adam for review.
Darin Adler
Comment 5 2012-01-31 08:45:00 PST
(In reply to comment #0) > Why does it work, you ask? That, dear sir or madam, I do not know. Oof. That’s a problem. We should figure out why. If possible, this fix should be done in the reinterpret_cast_ptr template rather than at the call site.
Andy Wingo
Comment 6 2012-01-31 12:30:21 PST
(In reply to comment #5) > (In reply to comment #0) > > Why does it work, you ask? That, dear sir or madam, I do not know. > > Oof. That’s a problem. We should figure out why. If possible, this fix should be done in the reinterpret_cast_ptr template rather than at the call site. I did some investigations before making this patch. The reinterpret_cast_ptr looks correct to my knowledge. The case that is taken for the aligned buffer is the __may_alias__ case. This is x86-64, so reinterpret_cast_ptr is reinterpret_cast. Every time I think I find a gcc bug I have been wrong. Still, it sounds possible in this case. This is gcc 4.6.2 from Debian unstable, with the default compilation options for the GTK+ port. FWIW, I have seen this warning for months, but only got bothered enough to look at it today.
Andy Wingo
Comment 7 2012-02-01 08:52:00 PST
WDYT, Darin? It is a bit inscrutable, but it is a correct change, and it makes --debug more useful for the gtk port. As it is, this error typically occurs for every file that is compiled, and it is preceded by hundreds of lines of template gobbledygook each time.
Darin Adler
Comment 8 2012-02-01 10:33:01 PST
(In reply to comment #7) > but it is a correct change I’m not sure what you mean by “correct change”. It’s probably OK to change this so the compiler stops complaining, but there is no reason this change should have any effect.
Andy Wingo
Comment 9 2012-02-01 13:33:22 PST
(In reply to comment #8) > (In reply to comment #7) > > but it is a correct change > > I’m not sure what you mean by “correct change”. It’s probably OK to change this so the compiler stops complaining, but there is no reason this change should have any effect. I didn't express myself well. I meant exactly what you said here.
Darin Adler
Comment 10 2012-02-01 14:04:41 PST
Anders, Gavin, do you have any alternative to landing this, and/or do you think it’s OK to just do this to sidestep the warning Andy is running into?
Gavin Barraclough
Comment 11 2012-02-01 17:00:27 PST
I've got no better suggestions, this is fine with me unless Anders has any better ideas. G.
Anders Carlsson
Comment 12 2012-02-01 17:51:50 PST
I don't have any better ideas, this looks good.
WebKit Review Bot
Comment 13 2012-02-02 11:13:03 PST
Comment on attachment 124704 [details] Patch Clearing flags on attachment: 124704 Committed r106574: <http://trac.webkit.org/changeset/106574>
WebKit Review Bot
Comment 14 2012-02-02 11:13:08 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.