[Bug c/54561] New: incorrect setjmp -Wclobber diagnostics
eggert at gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Sep 12 20:53:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54561
Bug #: 54561
Summary: incorrect setjmp -Wclobber diagnostics
Classification: Unclassified
Product: gcc
Version: 4.7.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: eggert@gnu.org
Created attachment 28180
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28180
generates incorrect diagnostics with gcc -O2 -Wclobbered
If I compile the attached program via the command "gcc -S -Wclobbered
-O2 w.i" (GCC 4.7.1, x86-64, Fedora 17), the output is:
w.i: In function 'png_load_body':
w.i:37:13: warning: variable 'info_ptr' might be clobbered by 'longjmp' or
'vfork' [-Wclobbered]
w.i:38:9: warning: variable 'fp' might be clobbered by 'longjmp' or 'vfork'
[-Wclobbered]
Both warnings are incorrect, because info_ptr and fp are not live
across any possible longjmp. If longjmp munges these variables,
setjmp must return a nonzero value, and no uses of these variables are
reachable in that case.
Like Bug#48968, I ran into this problem when building Emacs. This test
case is much shorter, though (I whittled it down), so it should be
easier to debug.
More information about the Gcc-bugs
mailing list