Subject: Re: [Suggestion] powerpc: xmon: about 'longjmp' related warning.

From: Michael Ellerman <[email-masked]>
Date: Tue, 23 Jul 2013 23:58:10 +1000

On Mon, Jul 22, 2013 at 03:02:53PM +0800, Chen Gang wrote:
> Hello Maintainers:
> 
> With allmodconfig and EXTRA_CFLAGS=-W", it reports warnings below:

> 
> arch/powerpc/xmon/xmon.c:3027:6: warning: variable ‘i’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]
> arch/powerpc/xmon/xmon.c:3068:6: warning: variable ‘i’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]

In both these cases we are inside the body of a for loop and we do a
if (setjmp) / else block. Although looking at the source the value of i
is not modified by the setjmp, I guess it's possible that the compiler
might reorder the increment of i inside the setjmp and loose the value
when we longjmp.

> arch/powerpc/xmon/xmon.c:352:48: warning: argument ‘fromipi’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Wclobbered]

This one I can't see, but I assume it's a similar case.

> Excuse me, I am not quite sure about it whether can cause issue or not.

I've never seen it get stuck in those loops or anything, but I guess
it's possible.

The first thing to do would be to analyse the generated assembler code
to determine if there really is any possiblity of the value being
clobbered, or if it's just a theoretical bug.

cheers