Wireshark-dev: Re: [Wireshark-dev] type punning error in packet-gtpv2.c
From: Martin Mathieson <[email protected]>
Date: Wed, 21 Jul 2010 13:25:12 +0100


On Tue, Jul 6, 2010 at 3:33 PM, Ed Beroset <[email protected]> wrote:
I just updated and attempted to build Wireshark on a 32-bit Linux box using gcc 4.1.2 and I find that I get an error in the epan/dissectors/packet-gtpv2.c file:

packet-gtpv2.c: In function 'proto_register_gtpv2':
packet-gtpv2.c:2136: warning: dereferencing type-punned pointer will break strict-aliasing rules
packet-gtpv2.c:2161: warning: dereferencing type-punned pointer will break strict-aliasing rules

Line 2136 contains the VALS() macro invocation:
       { &hf_gtpv2_cause_type,
       {"Cause Type","gtpv2.cause_type",
       FT_UINT8, BASE_DEC|BASE_EXT_STRING, VALS(&gtpv2_cause_type_vals_ext),0x0f,
       NULL, HFILL}
       },

The problem is with the VALS() invocation, but before I dive into it, I thought I'd see if anybody else is seeing this or is already working on it.

If I back up to version 33350 of packet-gtpv2.c, I don't get any errors and it builds just fine.  As an interesting point of reference, I don't get this error on my 64-bit Linux box (gcc 4.4.3), nor on the Windows machine (MSVC Express 2008).  I wonder if this might be a compiler version issue.  This box is running Fedora Core 8 (yes, I know it's old).

Ed

Hi Ed,
I had the same warnings under gcc 3.4.6.  Until now I'd just removed it from my local copy of epan/dissectors/Makefile.common, but I might actually want to use this dissector now.

value_type_ext hasn't been used  much, but I followed the same advice that arose from a discussion when packet-q708.c was broken in a similar way.

Martin