RESOLVED FIXED 139222
Fix cast-align warning in StringImpl.h
https://bugs.webkit.org/show_bug.cgi?id=139222
Summary Fix cast-align warning in StringImpl.h
Csaba Osztrogonác
Reported 2014-12-03 07:14:55 PST
Fix cast-align warning in StringImpl.h
Attachments
Patch (1.50 KB, patch)
2014-12-03 07:18 PST, Csaba Osztrogonác
no flags
Csaba Osztrogonác
Comment 1 2014-12-03 07:16:40 PST
warning log on ARM Linux build: ../../Source/WTF/wtf/text/StringImpl.h: In instantiation of ‘T* WTF::StringImpl::tailPointer() [with T = short unsigned int]’: ../../Source/WTF/wtf/text/StringImpl.h:182:39: required from here ../../Source/WTF/wtf/text/StringImpl.h:749:87: warning: cast from ‘uint8_t* {aka unsigned char*}’ to ‘short unsigned int*’ increases required alignment of target type [-Wcast-align] return reinterpret_cast_ptr<T*>(reinterpret_cast<uint8_t*>(this) + tailOffset<T>()); ^ ../../Source/WTF/wtf/text/StringImpl.h: In instantiation of ‘const T* WTF::StringImpl::tailPointer() const [with T = short unsigned int]’: ../../Source/WTF/wtf/text/StringImpl.h:720:47: required from here ../../Source/WTF/wtf/text/StringImpl.h:743:99: warning: cast from ‘const uint8_t* {aka const unsigned char*}’ to ‘const short unsigned int*’ increases required alignment of target type [-Wcast-align] return reinterpret_cast_ptr<const T*>(reinterpret_cast<const uint8_t*>(this) + tailOffset<T>()); ^ ../../Source/WTF/wtf/text/StringImpl.h: In instantiation of ‘const T* WTF::StringImpl::tailPointer() const [with T = WTF::StringImpl*]’: ../../Source/WTF/wtf/text/StringImpl.h:756:42: required from here ../../Source/WTF/wtf/text/StringImpl.h:743:99: warning: cast from ‘const uint8_t* {aka const unsigned char*}’ to ‘WTF::StringImpl* const*’ increases required alignment of target type [-Wcast-align] ../../Source/WTF/wtf/text/StringImpl.h: In instantiation of ‘T* WTF::StringImpl::tailPointer() [with T = WTF::StringImpl*]’: ../../Source/WTF/wtf/text/StringImpl.h:763:42: required from here ../../Source/WTF/wtf/text/StringImpl.h:749:87: warning: cast from ‘uint8_t* {aka unsigned char*}’ to ‘WTF::StringImpl**’ increases required alignment of target type [-Wcast-align] return reinterpret_cast_ptr<T*>(reinterpret_cast<uint8_t*>(this) + tailOffset<T>()); ^ These casts are safe, tailOffset guarantees the alignment.
Csaba Osztrogonác
Comment 2 2014-12-03 07:18:07 PST
cc-ing Anders and Andreas, because https://trac.webkit.org/changeset/163341 touched these lines last time.
Csaba Osztrogonác
Comment 3 2014-12-03 07:18:14 PST
WebKit Commit Bot
Comment 4 2014-12-04 11:22:10 PST
Comment on attachment 242490 [details] Patch Clearing flags on attachment: 242490 Committed r176805: <http://trac.webkit.org/changeset/176805>
WebKit Commit Bot
Comment 5 2014-12-04 11:22:14 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.