[ 
https://issues.apache.org/jira/browse/THRIFT-1057?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chris Morgan updated THRIFT-1057:
---------------------------------

    Description: 
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.

  was:
Code is doing things like:

uint8_t b[2];
uint16_t val;

val = *(int16_t*)b;

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.


> 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
>
> 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

        

Reply via email to