public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/48544] New: "might be clobbered by ‘longjmp’" diagnostic for unmodified variable
@ 2011-04-10 19:15 adl at gnu dot org
  2015-08-20 11:22 ` [Bug middle-end/48544] " adl at gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: adl at gnu dot org @ 2011-04-10 19:15 UTC (permalink / raw)
  To: gcc-bugs

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.


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

* [Bug middle-end/48544] "might be clobbered by ‘longjmp’" diagnostic for unmodified variable
  2011-04-10 19:15 [Bug c/48544] New: "might be clobbered by ‘longjmp’" diagnostic for unmodified variable adl at gnu dot org
@ 2015-08-20 11:22 ` adl at gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: adl at gnu dot org @ 2015-08-20 11:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Alexandre Duret-Lutz <adl at gnu dot org> ---
This works OK with 4.8 and 5.1, so not an issue anymore as far as I'm
concerned.
(Might be related to #48968 which is reported as "half-fixed" -- I haven't
tried.)


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

end of thread, other threads:[~2015-08-20 11:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-10 19:15 [Bug c/48544] New: "might be clobbered by ‘longjmp’" diagnostic for unmodified variable adl at gnu dot org
2015-08-20 11:22 ` [Bug middle-end/48544] " adl at gnu dot 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).