This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/25399] Another bogus 'clobbered by longjmp' message
- From: "dalej at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Dec 2005 23:19:23 -0000
- Subject: [Bug middle-end/25399] Another bogus 'clobbered by longjmp' message
- References: <bug-25399-1620@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #5 from dalej at gcc dot gnu dot org 2005-12-13 23:19 -------
This slight modification shows another problem: when the message refers to an
inlined copy of a variable, it points to the inlined function body and variable
rather than the place where the problem is. In the following you get
small2.c: In function 'foo':
small2.c:9: warning: variable 'temp' might be clobbered by 'longjmp' or 'vfork'
which has proved baffling to people who've hit it: there is no 'temp' in foo,
and no 'setjmp' in the function that does contain a temp. (In the maximally
confusing case, foo could contain a completely unrelated 'temp' which is
visibly not live across a setjmp.)
struct ss { unsigned short a; unsigned short b; };
union uu { unsigned int all; struct ss parts; };
#include <setjmp.h>
extern void bar(union uu);
extern void baz();
union uu func(union uu uuin) {
union uu temp;
if (uuin.parts.b)
return uuin;
temp.parts.a = 0; temp.parts.b = 0;
return temp;
}
void foo(int i, union uu uuin) {
for(;;)
{
union uu u = func(uuin);
jmp_buf env;
bar(u);
if (setjmp(env)==0)
baz();
else
baz();
}
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25399