You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "Mladen Turk (JIRA)" <ji...@apache.org> on 2010/05/27 14:58:27 UTC
[jira] Created: (TS-378) FIx the strict-aliasing rules warnings
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.
[jira] Commented: (TS-378) FIx the strict-aliasing rules warnings
Posted by "Leif Hedstrom (JIRA)" <ji...@apache.org>.
[ 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.
[jira] Updated: (TS-378) FIx the strict-aliasing rules warnings
Posted by "Leif Hedstrom (JIRA)" <ji...@apache.org>.
[ 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: 2.2.0)
2.3.0
> 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.3.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.
[jira] Commented: (TS-378) FIx the strict-aliasing rules warnings
Posted by "Leif Hedstrom (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/TS-378?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12872224#action_12872224 ]
Leif Hedstrom commented on TS-378:
----------------------------------
As pointed out in the TS-302 bug, and the reason why we compile with -fno-strict-aliasing, is that it also has very undesirable behavior on cache etc. I.e. just fixing the compile warnings above might not be enough.
Granted, the original bug was using a much older compiler, so maybe fixing the warnings now will solve the problem, but with the old compiler it was not enough (i.e. it'd compile with -Wall -Werror, and still fail miserably in the cache with strict-aliasing enabled).
> 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.