Re: [PATCH] powerpc/xmon: avoid warnings about variables that might be clobbered by âlongjmpâ

From: Mathieu Malaterre
Date: Tue Jun 26 2018 - 02:27:25 EST


On Sat, Jun 23, 2018 at 9:47 PM Segher Boessenkool
<segher@xxxxxxxxxxxxxxxxxxx> wrote:
>
> On Sat, Jun 23, 2018 at 06:59:27PM +0200, christophe leroy wrote:
> >
> >
> > Le 22/06/2018 Ã 21:27, Mathieu Malaterre a Ãcrit :
> > >Move initialization of variables after data definitions. This silence
> > >warnings treated as error with W=1:
> > >
> > > arch/powerpc/xmon/xmon.c:3389:14: error: variable ânameâ might be
> > > clobbered by âlongjmpâ or âvforkâ [-Werror=clobbered]
> > > arch/powerpc/xmon/xmon.c:3100:22: error: variable âtskâ might be
> > > clobbered by âlongjmpâ or âvforkâ [-Werror=clobbered]
> >
> > Is that an invalid warning ?
>
> No, both are correct warnings. GCC can not see which functions it only
> has a declaration of can call longjmp.

I assumed those were false positive warnings, given how easy it was to
defeat them. Let give it another try.

> > Otherwise, I'd expect one to fix the warning, not just cheat on GCC.
>
> Yes, the patch seems to change the code in such a way that some versions
> of GCC will no longer warn. Which does not make to code any more correct.
>
> Either restructure the code, or make the var non-automatic, or make it
> volatile.
>
>
> Segher