Wireshark-dev: [Wireshark-dev] type punning error in packet-gtpv2.c
From: Ed Beroset <beroset@xxxxxxxxxxxxxx>
Date: Tue, 6 Jul 2010 10:33:13 -0400 (EDT)
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