public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "adl at gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/48544] New: "might be clobbered by ‘longjmp’" diagnostic for unmodified variable
Date: Sun, 10 Apr 2011 19:15:00 -0000	[thread overview]
Message-ID: <bug-48544-4@http.gcc.gnu.org/bugzilla/> (raw)

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

           Summary: "might be clobbered by ‘longjmp’" diagnostic for
                    unmodified variable
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: adl@gnu.org


Created attachment 23939
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23939
preprocessed input

% uname -a
Linux hush 2.6.32-5-amd64 #1 SMP Wed Jan 12 03:40:32 UTC 2011 x86_64 GNU/Linux
% gcc-4.6 --version
gcc-4.6 (Debian 4.6.0-2) 4.6.1 20110329 (prerelease)
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
% cat foo.c
#include <setjmp.h>

jmp_buf env;
void foo(int);

int bar(int r, int var)
{
  if (var)
    return r;
  if (setjmp(env) == 0)
    foo(r);
  return 0;
}
% gcc-4.6 -Wall -Wextra -O2 -c foo.c
foo.c: In function ‘bar’:
foo.c:6:13: warning: argument ‘r’ might be clobbered by ‘longjmp’ or ‘vfork’
[-Wclobbered]

If I understand this message correctly, GCC is warning me that "r" might be
reset to the value it had before calling setjmp().  However, I never changed
the value of "r", so I don't think this warning should be emitted.

Note that removing the "if (var) return r;" lines makes the warning go away.


             reply	other threads:[~2011-04-10 19:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-10 19:15 adl at gnu dot org [this message]
2015-08-20 11:22 ` [Bug middle-end/48544] " adl at gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-48544-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).