Wireshark-dev: Re: [Wireshark-dev] "Type-punned pointer... breaks anti-aliasing rules" in dfilt
From: Evan Huus <[email protected]>
Date: Tue, 18 Jun 2013 18:09:27 -0700
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 <[email protected]> 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 <[email protected]>
> Archives:    http://www.wireshark.org/lists/wireshark-dev
> Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
>             mailto:[email protected]?subject=unsubscribe