RESOLVED FIXED 118242
Fix cast-align warnings in JavaScriptCore/heap/HandleBlockInlines.h
https://bugs.webkit.org/show_bug.cgi?id=118242
Summary Fix cast-align warnings in JavaScriptCore/heap/HandleBlockInlines.h
Csaba Osztrogonác
Reported 2013-07-01 06:37:48 PDT
/home/oszi/Source/JavaScriptCore/heap/HandleBlockInlines.h:58:51: warning: cast from 'char*' to 'JSC::HandleNode*' increases required alignment of target type [-Wcast-align] This code introduced in http://trac.webkit.org/changeset/146734 : ... inline char* HandleBlock::payload() { return reinterpret_cast<char*>(this) + WTF::roundUpToMultipleOf<sizeof(double)>(sizeof(HandleBlock)); } inline HandleNode* HandleBlock::nodes() { return reinterpret_cast<HandleNode*>(payload()); <------ line 58 } ... This part of JSC isn't quite clear for me. As far as I understand a HandleBlock is 4K sized block on JSC heap, which contains HandleNode instances on int payload. And the payload is 64 bit aligned after the HandleBlock instance. Am I correct? If yes, I think this casting is safe and can be supressed by using reinterpret_cast_ptr instead of reinterpret_cast, because HandleNode has two following members: JSValue, HandleNode* and HandleNode* .
Attachments
Patch (1.28 KB, patch)
2013-07-01 06:39 PDT, Csaba Osztrogonác
no flags
Csaba Osztrogonác
Comment 1 2013-07-01 06:39:28 PDT
Mark Hahnenberg
Comment 2 2013-07-01 08:10:01 PDT
Comment on attachment 205807 [details] Patch r=me. We use char* to make the pointer arithmetic easier, so it's fine that the cast changes the alignment. Thanks for fixing this!
Csaba Osztrogonác
Comment 3 2013-07-01 08:39:41 PDT
Comment on attachment 205807 [details] Patch Clearing flags on attachment: 205807 Committed r152225: <http://trac.webkit.org/changeset/152225>
Csaba Osztrogonác
Comment 4 2013-07-01 08:39:47 PDT
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.