[LTP] [PATCH 2/3] syscalls/pipe*: Fix compiler warnings

Petr Vorel pvorel@suse.cz
Tue Mar 6 16:03:02 CET 2018


Hi Jinhui,

> > > Signed-off-by: Jinhui Huang<huangjh.jy@cn.fujitsu.com>
> > > ---
> > >   testcases/kernel/syscalls/pipe/pipe04.c | 2 +-
> > >   testcases/kernel/syscalls/pipe/pipe05.c | 4 ++--
> > >   testcases/kernel/syscalls/pipe/pipe07.c | 2 +-
> > >   testcases/kernel/syscalls/pipe/pipe08.c | 2 ++
> > >   testcases/kernel/syscalls/pipe/pipe11.c | 6 +++---
> > >   5 files changed, 9 insertions(+), 7 deletions(-)
...

> Hi Petr,

> The compiler warning:
> pipe05.c: In function ‘main’:
> pipe05.c:62:6: warning: variable ‘lc’ might be clobbered by ‘longjmp’ or
> ‘vfork’ [-Wclobbered]
> int lc;
> We may avoid this warning by declaring "lc" as volatile which tells the
> optimizer not to optimize it.
Thanks for info. This was issued by gcc-4.x, that's why I didn't notice that.
I pushed the patch, thanks!
BTW these tests deserve rewriting into new API, that would be a big improvement.


Kind regards,
Petr


More information about the ltp mailing list