You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "Leif Hedstrom (Updated) (JIRA)" <ji...@apache.org> on 2011/10/10 18:07:30 UTC

[jira] [Updated] (TS-378) FIx the strict-aliasing rules warnings

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

Leif Hedstrom updated TS-378:
-----------------------------

    Fix Version/s:     (was: 3.1.2)
                   3.1.3

I'm moving all 3.1.2 bugs out to 3.1.3, and we can move some 3.1.1 bugs out to 3.1.2, to get some release action going.
                
> FIx the strict-aliasing rules warnings
> --------------------------------------
>
>                 Key: TS-378
>                 URL: https://issues.apache.org/jira/browse/TS-378
>             Project: Traffic Server
>          Issue Type: Improvement
>          Components: Cleanup
>    Affects Versions: 2.1.6
>            Reporter: Mladen Turk
>            Assignee: Mladen Turk
>            Priority: Minor
>             Fix For: 3.1.3
>
>
> Currently the compile fails with -fstrict-aliasing.
> The reason is mostly using int pointers to read or write 64 bit numbers
> Eg. INK_MD5.cc has
> struct INK_MD5
> {
>   uint64 b[2];
>   uint32 word(int i)
>   {
>     uint32 *p = (uint32 *) & b[0];
>     return p[i];
>   }
>  ...
> };
> Such things can be easily fixed and properly handled using unions
> (they are invented for that)
> struct INK_MD5
> {
>   union {
>      uint64 q[2];
>      uint32 u[4];
>      unsigned char b[16];
>   } s;
>   uint32 word(int i)
>   {
>     return s.w[i];
>   }
>  ...
> };

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira