------- 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

Reply via email to