ptrace compile failure with gcc-8.2 on 32-bit powerpc

From: Meelis Roos
Date: Thu Aug 16 2018 - 03:45:05 EST


After upgrading my distro compiler to gcc-8.2, Linux fails to compile on
32-bit powerpc (tested with 4.17, 4.18 and v4.18-7873-gf91e654474d4).


CC arch/powerpc/kernel/ptrace.o
In file included from ./include/linux/bitmap.h:9,
from ./include/linux/cpumask.h:12,
from ./include/linux/rcupdate.h:44,
from ./include/linux/rculist.h:11,
from ./include/linux/pid.h:5,
from ./include/linux/sched.h:14,
from arch/powerpc/kernel/ptrace.c:19:
In function ʽmemcpyʼ,
inlined from ʽuser_regset_copyinʼ at ./include/linux/regset.h:295:4,
inlined from ʽvr_setʼ at arch/powerpc/kernel/ptrace.c:619:9:
./include/linux/string.h:345:9: error: ʽ__builtin_memcpyʼ offset [-527, -529] is out of the bounds [0, 16] of object ʽvrsaveʼ with type ʽunion <anonymous>ʼ [-Werror=array-bounds]
return __builtin_memcpy(p, q, size);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/kernel/ptrace.c: In function ʽvr_setʼ:
arch/powerpc/kernel/ptrace.c:614:5: note: ʽvrsaveʼ declared here
} vrsave;
^~~~~~
In file included from ./include/linux/bitmap.h:9,
from ./include/linux/cpumask.h:12,
from ./include/linux/rcupdate.h:44,
from ./include/linux/rculist.h:11,
from ./include/linux/pid.h:5,
from ./include/linux/sched.h:14,
from arch/powerpc/kernel/ptrace.c:19:
In function ʽmemcpyʼ,
inlined from ʽuser_regset_copyoutʼ at ./include/linux/regset.h:270:4,
inlined from ʽvr_getʼ at arch/powerpc/kernel/ptrace.c:572:9:
./include/linux/string.h:345:9: error: ʽ__builtin_memcpyʼ offset [-527, -529] is out of the bounds [0, 16] of object ʽvrsaveʼ with type ʽunion <anonymous>ʼ [-Werror=array-bounds]
return __builtin_memcpy(p, q, size);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/kernel/ptrace.c: In function ʽvr_getʼ:
arch/powerpc/kernel/ptrace.c:567:5: note: ʽvrsaveʼ declared here
} vrsave;
^~~~~~
cc1: all warnings being treated as errors
make[1]: *** [scripts/Makefile.build:311: arch/powerpc/kernel/ptrace.o] Error 1


--
Meelis Roos (mroos@xxxxxxxx)