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 (JIRA)" <ji...@apache.org> on 2010/05/27 15:22:27 UTC
[jira] Commented: (TS-378) FIx the strict-aliasing rules warnings
[ https://issues.apache.org/jira/browse/TS-378?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12872211#action_12872211 ]
Leif Hedstrom commented on TS-378:
----------------------------------
Is this not a duplicate of TS-302? If so, we shold close one of the two as a duplicate.
> 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.2.0
> Reporter: Mladen Turk
> Assignee: Mladen Turk
> Priority: Minor
> Fix For: 2.2.0
>
>
> 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.
-
You can reply to this email to add a comment to the issue online.