RESOLVED FIXED 117991
Fix cast-align warnings in FastMalloc.cpp
https://bugs.webkit.org/show_bug.cgi?id=117991
Summary Fix cast-align warnings in FastMalloc.cpp
Csaba Osztrogonác
Reported 2013-06-25 08:03:05 PDT
/home/oszi/WebKit/Source/WTF/wtf/FastMalloc.cpp:3167:102: warning: cast from 'char*' to 'uint32_t* {aka unsigned int*}' increases required alignment of target type [-Wcast-align] /home/oszi/WebKit/Source/WTF/wtf/FastMalloc.cpp:3167:194: warning: cast from 'char*' to 'uint32_t* {aka unsigned int*}' increases required alignment of target type [-Wcast-align] /home/oszi/WebKit/Source/WTF/wtf/FastMalloc.cpp:3167:305: warning: cast from 'char*' to 'uint32_t* {aka unsigned int*}' increases required alignment of target type [-Wcast-align] /home/oszi/WebKit/Source/WTF/wtf/FastMalloc.cpp:3167:52: warning: cast from 'char*' to 'uint32_t* {aka unsigned int*}' increases required alignment of target type [-Wcast-align] 3167: POISON_DEALLOCATION_EXPLICIT(ptr, size, startPoison, endPoison); #define POISON_DEALLOCATION_EXPLICIT(allocation, allocationSize, startPoison, endPoison) do { \ ASSERT((allocationSize) >= 2 * sizeof(uint32_t)); \ reinterpret_cast<uint32_t*>(allocation)[0] = 0xbadbeef9; \ reinterpret_cast<uint32_t*>(allocation)[1] = 0xbadbeefb; \ if ((allocationSize) < 4 * sizeof(uint32_t)) \ break; \ reinterpret_cast<uint32_t*>(allocation)[2] = (startPoison) ^ PTR_TO_UINT32(allocation); \ reinterpret_cast<uint32_t*>(allocation)[END_POISON_INDEX(allocationSize)] = (endPoison) ^ PTR_TO_UINT32(allocation); \ } while (false) This define introduced in - https://trac.webkit.org/changeset/143488/trunk/Source/WTF/wtf/FastMalloc.cpp - https://trac.webkit.org/changeset/143996/trunk/Source/WTF/wtf/FastMalloc.cpp The question is that ptr in line 3167 is uint32_t aligned or not?
Attachments
Patch (1.89 KB, patch)
2013-07-02 08:38 PDT, Csaba Osztrogonác
no flags
Csaba Osztrogonác
Comment 1 2013-07-01 02:23:47 PDT
Could you check if they can be a valid warnings or can we suppress them with using reinterpret_cast_ptr instead of reinterpret_cast ?
Csaba Osztrogonác
Comment 2 2013-07-02 07:56:35 PDT
any idea?
Mark Hahnenberg
Comment 3 2013-07-02 08:35:05 PDT
(In reply to comment #2) > any idea? I think this one is okay to change to reinterpret_cast_ptr too because all FastMalloc allocations are guaranteed to be at least 8 byte aligned.
Csaba Osztrogonác
Comment 4 2013-07-02 08:38:31 PDT
Csaba Osztrogonác
Comment 5 2013-07-02 08:44:15 PDT
(In reply to comment #3) > (In reply to comment #2) > > any idea? > > I think this one is okay to change to reinterpret_cast_ptr too because all FastMalloc allocations are guaranteed to be at least 8 byte aligned. Thanks, I attached the patch.
Mark Hahnenberg
Comment 6 2013-07-02 09:13:25 PDT
Comment on attachment 205919 [details] Patch r=me
Csaba Osztrogonác
Comment 7 2013-07-03 03:19:58 PDT
Comment on attachment 205919 [details] Patch Clearing flags on attachment: 205919 Committed r152349: <http://trac.webkit.org/changeset/152349>
Csaba Osztrogonác
Comment 8 2013-07-03 03:20:04 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.