public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/48968] New: incorrect warning about longjmp/vfork clobbering a local (-W -O2, x86-64)
@ 2011-05-11 20:04 eggert at gnu dot org
  2011-05-11 20:00 ` [Bug c/48968] " eggert at gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: eggert at gnu dot org @ 2011-05-11 20:04 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: incorrect warning about longjmp/vfork clobbering a
                    local (-W -O2, x86-64)
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: eggert@gnu.org


The attached program u.i, derived from the Emacs trunk,
has code of the following form:

  Lisp_Object XXXevent, tem;

  if (idx < 0)
    {
      XXXevent = Qnil;
    }
  else
    {
      Lisp_Object _l; _l.s.val = idx; _l.s.type = Lisp_Int;
      XXXevent = _l;
    }

  if ((((enum Lisp_Type) ((XXXevent)).u.type)) == Lisp_Int)
    {
      ...
    }

These are the only defs and uses of XXXevent, which is a local
variable of union type.  When compiled with -W -O2 on x86-64,
GCC 4.6.0 complains:

  error: variable 'XXXevent' might be clobbered by 'longjmp' or 'vfork'

But no longjmp or vfork is possible between the time that XXXevent is
set, and the time that it is used.

I worry that this bogus warning is a symptom of deeper problems in
GCC 4.6.0's optimizer.

Here is the full output of:

gcc -v -save-temps -S -W -Wno-missing-field-initializers -Wno-sign-compare
-Werror -O2 u.i

  Using built-in specs.
  COLLECT_GCC=gcc
 
COLLECT_LTO_WRAPPER=/usr/local_cs/linux/gcc-4.6.0/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/lto-wrapper
  Target: x86_64-unknown-linux-gnu
  Configured with: ../gcc-4.6.0/configure --prefix=/usr/local/cs/gcc-4.6.0
--with-gmp-include=/usr/local/cs/include --disable-nls
--with-stage1-ldflags='-L/usr/local/cs/lib64 -Xlinker
-rpath=/usr/local/cs/lib64' --with-boot-ldflags='-L/usr/local/cs/lib64 -Xlinker
-rpath=/usr/local/cs/lib64' LDFLAGS='-L/usr/local/cs/lib64 -Xlinker
-rpath=/usr/local/cs/lib64'
  Thread model: posix
  gcc version 4.6.0 (GCC)
  COLLECT_GCC_OPTIONS='-v' '-save-temps' '-S' '-Wextra'
'-Wno-missing-field-initializers' '-Wno-sign-compare' '-Werror' '-O2'
'-mtune=generic' '-march=x86-64'
  
/usr/local_cs/linux/gcc-4.6.0/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/cc1
-fpreprocessed u.i -quiet -dumpbase u.i -mtune=generic -march=x86-64 -auxbase u
-O2 -Wextra -Wno-missing-field-initializers -Wno-sign-compare -Werror -version
-o u.s
  GNU C (GCC) version 4.6.0 (x86_64-unknown-linux-gnu)
      compiled by GNU C version 4.6.0, GMP version 5.0.2, MPFR version
3.0.1-p4, MPC version 0.9
  GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
  GNU C (GCC) version 4.6.0 (x86_64-unknown-linux-gnu)
      compiled by GNU C version 4.6.0, GMP version 5.0.2, MPFR version
3.0.1-p4, MPC version 0.9
  GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
  Compiler executable checksum: 48a4f3d76c3a714a5f5622b4f42440c5
  u.i: In function 'read_char':
  u.i:60167:20: error: variable 'XXXevent' might be clobbered by 'longjmp' or
'vfork' [-Werror=clobbered]
  cc1: all warnings being treated as errors


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2014-01-19 20:31 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-11 20:04 [Bug c/48968] New: incorrect warning about longjmp/vfork clobbering a local (-W -O2, x86-64) eggert at gnu dot org
2011-05-11 20:00 ` [Bug c/48968] " eggert at gnu dot org
2011-05-12 11:07 ` rguenth at gcc dot gnu.org
2011-05-12 13:54 ` schwab@linux-m68k.org
2011-05-12 19:11 ` jakub at gcc dot gnu.org
2011-05-12 20:22 ` eggert at gnu dot org
2012-06-01 20:42 ` eggert at gnu dot org
2012-06-01 21:19 ` eggert at gnu dot org
2014-01-19 18:01 ` mpolacek at gcc dot gnu.org
2014-01-19 18:34 ` eggert at gnu dot org
2014-01-19 20:31 ` mpolacek at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).