Wireshark mailing list archives

Re: "Type-punned pointer... breaks anti-aliasing rules" in dfilter-macro.c


From: Gilbert Ramirez <gram () alumni rice edu>
Date: Wed, 29 Jan 2014 15:56:12 -0800

I have attempted a code fix to remove all the -fstrict-alias warnings
uncovered by the old version of gcc I am using.

https://code.wireshark.org/review/#/c/40/

Gilbert


On Wed, Jan 29, 2014 at 4:37 AM, Gilbert Ramirez <gram () alumni rice edu>wrote:

I'm encountering the same problem building on an old RedHat 5.0 system,
using gcc 4.1.2.  Was there any fix committed to add -fno-strict-aliasing
for some configurations? (there doesn't appear to be)

Gilbert


On Tue, Jun 18, 2013 at 6:09 PM, Evan Huus <eapache () gmail com> wrote:

Probably the simplest fix is to add -fno-strict-aliasing to the build
flags on FreeBSD.

On 2013-06-18, at 4:14 PM, Stephen Fisher <
stephenfisher-wireshark () outlook com> wrote:

When trying to compile Wireshark (SVN trunk) on FreeBSD for the first
time in a long time, I ran across a familiar error:

    dfilter-macro.c: In function 'dfilter_macro_init':
    dfilter-macro.c:614: warning: dereferencing type-punned pointer
will break strict-aliasing rules

However, line 614 has a history of being changed between this:

    (void*) &macros,

and this (as it currently is):

    (void**) &macros,

Which is the fifth parameter in a call to uat_new() where parameter
five's type is "void** data_ptr" and macros is type dfilter_macro_t*.

This was most recently changed with SVN revision 48355 that Anders
committed in response to bug 8416 ("remove C++ incompatibilities")
according to the SVN log.  Before that, judging by the "svn annotate"
output in Emacs of a few lines earlier, I changed it from (void**) to
(void*) way back in 2007 as SVN revision 21330 to "Fix warnings on
Linux/gcc 4.1.1" and it may have changed at other times as well.

What should the fix ultimately be if one way breaks FreeBSD/gcc 4.2.1
compiles and if it introduces C++ compatibility issues (which I'm not
familiar with since I haven't been following development for a while
lately).

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
            mailto:wireshark-dev-request () wireshark org
?subject=unsubscribe

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org
?subject=unsubscribe



___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

Current thread: