[Webkit-unassigned] [Bug 38045] Avoid increasing required alignment of target type warning on ARM

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jul 29 19:49:35 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=38045


Gavin Barraclough <barraclough at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |




--- Comment #21 from Gavin Barraclough <barraclough at apple.com>  2010-07-29 19:49:34 PST ---
Rolled out in: https://bugs.webkit.org/show_bug.cgi?id=43223

The implementation of reinterpret_cast_ptr for ARM/GCC should probably be more like:

template<typename Type>
bool isPointerTypeAlignmentOkay(Type* ptr)
{
    return !(reinterpret_cast<intptr_t>(ptr) % __alignof__(Type));
}

template<typename TypePtr>
TypePtr reinterpret_cast_ptr(void* ptr)
{
    ASSERT(isPointerTypeAlignmentOkay(reinterpret_cast<TypePtr>(ptr)));
    return reinterpret_cast<TypePtr>(ptr);
}

template<typename TypePtr>
const TypePtr reinterpret_cast_ptr(const void* ptr)
{
    ASSERT(isPointerTypeAlignmentOkay(reinterpret_cast<TypePtr>(ptr)));
    return reinterpret_cast<TypePtr>(ptr);
}

The ASSERT should be checking the alignment of the Type, not the type of TypePtr.  reinterpret_cast of a const pointer should not change constness.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list