[
https://issues.apache.org/jira/browse/THRIFT-1057?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Chris Morgan updated THRIFT-1057:
---------------------------------
Attachment: fix_strict_aliasing_warning.patch
Use unions to ensure proper alignment and stop gcc warnings about
"dereferencing type-punned pointer will break strict-aliasing rules" warnings.
> casts in TBinaryProtocol.tcc causing "dereferencing type-punned pointer will
> break strict-aliasing rules" warnings from gcc
> ----------------------------------------------------------------------------------------------------------------------------
>
> Key: THRIFT-1057
> URL: https://issues.apache.org/jira/browse/THRIFT-1057
> Project: Thrift
> Issue Type: Bug
> Components: C++ - Library
> Affects Versions: 0.7
> Reporter: Chris Morgan
> Attachments: fix_strict_aliasing_warning.patch
>
>
> Code is doing things like:
> {code}
> uint8_t b[2];
> uint16_t val;
> val = *(int16_t*)b;
> {code}
> Due to aliasing there isn't a guarantee that b[] will be placed on a 16 bit
> boundary.
> Fix is to use unions to ensure alignment. Patch attached.
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira