https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83162

            Bug ID: 83162
           Summary: x86-64 -Wclobbered issuing more false alarms
                    (regression)
           Product: gcc
           Version: 7.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: eggert at gnu dot org
  Target Milestone: ---

Created attachment 42717
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42717&action=edit
Test case for "gcc -O2 -S -Wclobbered" on x86-64

When building GNU Emacs we're finding that -Wclobbered is now issuing so many
false alarms that I think we will turn it off in more modules. I ran into this
problem again today, and narrowed it down to the attached program simplified
from Emacs. Compile and run it with:

gcc -O2 -S -Wclobbered clobbered.c

and GCC outputs:

clobbered.c: In function ‘module_vec_set’:
clobbered.c:22:29: warning: argument ‘vec’ might be clobbered by ‘longjmp’ or
‘vfork’ [-Wclobbered]
 module_vec_set (Lisp_Object vec, long i, Lisp_Object val)
                             ^~~
clobbered.c:22:54: warning: argument ‘val’ might be clobbered by ‘longjmp’ or
‘vfork’ [-Wclobbered]
 module_vec_set (Lisp_Object vec, long i, Lisp_Object val)
                                                      ^~~

Both diagnostics are bogus, since _setjmp's caller immediately returns if
_setjmp returns nonzero.

I am using gcc (GCC) 7.2.1 20170915 (Red Hat 7.2.1-2) on x86-64. I do not
observe the problem with gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16), so it is
a regression.

Also see Bug 21161, Bug 48968, Bug 54561, Bug 61118, and Bug 65041. This
particular test case appears to be new though, as it is a regression.

Reply via email to