powerpc/ptrace: Fix build with gcc 4.6
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Mon, 26 Sep 2011 19:37:57 +0000 (19:37 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Dec 2012 18:49:02 +0000 (10:49 -0800)
commitf2a1abc8cfa0220a550c5a54440a5e97ef025899
tree71325fb1c2331af0bc8ae2d7f930a7aca533f5ef
parent15a83cc22d40240f1f551b4c2092f7f246bdbfce
powerpc/ptrace: Fix build with gcc 4.6

commit e69b742a6793dc5bf16f6eedca534d4bc10d68b2 upstream.

gcc (rightfully) complains that we are accessing beyond the
end of the fpr array (we do, to access the fpscr).

The only sane thing to do (whether anything in that code can be
called remotely sane is debatable) is to special case fpscr and
handle it as a separate statement.

I initially tried to do it it by making the array access conditional
to index < PT_FPSCR and using a 3rd else leg but for some reason gcc
was unable to understand it and still spewed the warning.

So I ended up with something a tad more intricated but it seems to
build on 32-bit and on 64-bit with and without VSX.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/kernel/ptrace.c