[Bug middle-end/54561] incorrect setjmp -Wclobber diagnostics

mat at matws dot net gcc-bugzilla@gcc.gnu.org
Wed Mar 19 04:57:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54561

Matthieu Patou <mat at matws dot net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mat at matws dot net

--- Comment #3 from Matthieu Patou <mat at matws dot net> ---
I have more issues with Gcc generating wrong warning.
When trying to compile new dissectors with gcc 4.8.8 in wireshark I got:

/home/mat/workspace/wireshark/epan/dissectors/packet-dcerpc-dnsserver.c: In
function ‘dnsserver_dissect_struct_DNS_RPC_NAME_LIST’:

/home/mat/workspace/wireshark/epan/dissectors/packet-dcerpc-dnsserver.c:1902:23:
warning: variable ‘tmptree’ might be clobbered by ‘longjmp’ or ‘vfork’
[-Wclobbered]
  volatile proto_tree *tmptree = NULL;

/home/mat/workspace/wireshark/epan/dissectors/packet-dcerpc-dnsserver.c:1903:23:
warning: variable ‘tmpitem’ might be clobbered by ‘longjmp’ or ‘vfork’
[-Wclobbered]
  volatile proto_item *tmpitem = NULL;

The manpage of longjmp states that 

"The values of automatic variables are unspecified after a call to longjmp() if
they meet all the following criteria:

       ·  they are local to the function that made the corresponding setjmp(3)
call;
       ·  their values are changed between the calls to setjmp(3) and
longjmp(); and
       ·  they are not declared as volatile."

So without the volatile keyword the warning would valid but I explicitly
specified volatile to avoid this warning, unless I mis-understood something I
think this warning shouldn't be emitted.


More information about the Gcc-bugs mailing list