From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18438 invoked by alias); 10 Apr 2011 19:15:11 -0000 Received: (qmail 18364 invoked by uid 22791); 10 Apr 2011 19:15:09 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,SARE_HEAD_8BIT_SPAM,SARE_SUB_ENC_UTF8 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 10 Apr 2011 19:15:05 +0000 From: "adl at gnu dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/48544] New: "=?UTF-8?Q?might=20be=20clobbered=20by=20=E2=80=98longjmp=E2=80=99?=" diagnostic for unmodified variable X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: adl at gnu dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Date: Sun, 10 Apr 2011 19:15:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-04/txt/msg01032.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D48544 Summary: "might be clobbered by =E2=80=98longjmp=E2=80=99" diagn= ostic 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=3D23939 preprocessed input % uname -a Linux hush 2.6.32-5-amd64 #1 SMP Wed Jan 12 03:40:32 UTC 2011 x86_64 GNU/Li= nux % 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 jmp_buf env; void foo(int); int bar(int r, int var) { if (var) return r; if (setjmp(env) =3D=3D 0) foo(r); return 0; } % gcc-4.6 -Wall -Wextra -O2 -c foo.c foo.c: In function =E2=80=98bar=E2=80=99: foo.c:6:13: warning: argument =E2=80=98r=E2=80=99 might be clobbered by =E2= =80=98longjmp=E2=80=99 or =E2=80=98vfork=E2=80=99 [-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.