outside array bounds error on ppc64_defconfig, GCC 12.1.0

Bagas Sanjaya bagasdotme at gmail.com
Wed Jun 1 12:52:32 AEST 2022


Hi,

I'm trying to verify Drop ppc_inst_as_str() patch on [1] by performing
ppc64_defconfig build with powerpc64-unknown-linux-gnu-gcc (GCC 12.1.0).
The patch is applied on top of powerpc tree, next branch.

I got outside array bounds error:

  CC      arch/powerpc/kernel/dbell.o
In function 'do_byte_reverse',
    inlined from 'do_vec_store' at arch/powerpc/lib/sstep.c:722:3,
    inlined from 'emulate_loadstore' at arch/powerpc/lib/sstep.c:3509:9:
arch/powerpc/lib/sstep.c:286:25: error: array subscript [3, 4] is outside array bounds of 'union <anonymous>[1]' [-Werror=array-bounds]
  286 |                 up[0] = byterev_8(up[3]);
      |                         ^~~~~~~~~~~~~~~~
arch/powerpc/lib/sstep.c: In function 'emulate_loadstore':
arch/powerpc/lib/sstep.c:708:11: note: at offset [24, 39] into object 'u' of size 16
  708 |         } u;
      |           ^
In function 'do_byte_reverse',
    inlined from 'do_vec_store' at arch/powerpc/lib/sstep.c:722:3,
    inlined from 'emulate_loadstore' at arch/powerpc/lib/sstep.c:3509:9:
arch/powerpc/lib/sstep.c:287:23: error: array subscript [3, 4] is outside array bounds of 'union <anonymous>[1]' [-Werror=array-bounds]
  287 |                 up[3] = tmp;
      |                 ~~~~~~^~~~~
arch/powerpc/lib/sstep.c: In function 'emulate_loadstore':
arch/powerpc/lib/sstep.c:708:11: note: at offset [24, 39] into object 'u' of size 16
  708 |         } u;
      |           ^
In function 'do_byte_reverse',
    inlined from 'do_vec_store' at arch/powerpc/lib/sstep.c:722:3,
    inlined from 'emulate_loadstore' at arch/powerpc/lib/sstep.c:3509:9:
arch/powerpc/lib/sstep.c:288:23: error: array subscript 2 is outside array bounds of 'union <anonymous>[1]' [-Werror=array-bounds]
  288 |                 tmp = byterev_8(up[2]);
      |                       ^~~~~~~~~~~~~~~~
arch/powerpc/lib/sstep.c: In function 'emulate_loadstore':
arch/powerpc/lib/sstep.c:708:11: note: at offset 16 into object 'u' of size 16
  708 |         } u;
      |           ^
In function 'do_byte_reverse',
    inlined from 'do_vec_store' at arch/powerpc/lib/sstep.c:722:3,
    inlined from 'emulate_loadstore' at arch/powerpc/lib/sstep.c:3509:9:
arch/powerpc/lib/sstep.c:289:23: error: array subscript 2 is outside array bounds of 'union <anonymous>[1]' [-Werror=array-bounds]
  289 |                 up[2] = byterev_8(up[1]);
      |                 ~~~~~~^~~~~~~~~~~~~~~~~~
arch/powerpc/lib/sstep.c: In function 'emulate_loadstore':
arch/powerpc/lib/sstep.c:708:11: note: at offset 16 into object 'u' of size 16
  708 |         } u;
      |           ^
In function 'do_byte_reverse',
    inlined from 'do_vec_load' at arch/powerpc/lib/sstep.c:691:3,
    inlined from 'emulate_loadstore' at arch/powerpc/lib/sstep.c:3438:9:
arch/powerpc/lib/sstep.c:286:25: error: array subscript [3, 4] is outside array bounds of 'u8[16]' {aka 'unsigned char[16]'} [-Werror=array-bounds]
  286 |                 up[0] = byterev_8(up[3]);
      |                         ^~~~~~~~~~~~~~~~
arch/powerpc/lib/sstep.c: In function 'emulate_loadstore':
arch/powerpc/lib/sstep.c:681:11: note: at offset [24, 39] into object 'u' of size 16
  681 |         } u = {};
      |           ^
arch/powerpc/lib/sstep.c:681:11: note: at offset [24, 39] into object 'u' of size 16
arch/powerpc/lib/sstep.c:681:11: note: at offset [24, 39] into object 'u' of size 16
arch/powerpc/lib/sstep.c:681:11: note: at offset [24, 39] into object 'u' of size 16
arch/powerpc/lib/sstep.c:681:11: note: at offset [24, 39] into object 'u' of size 16
In function 'do_byte_reverse',
    inlined from 'do_vec_load' at arch/powerpc/lib/sstep.c:691:3,
    inlined from 'emulate_loadstore' at arch/powerpc/lib/sstep.c:3438:9:
arch/powerpc/lib/sstep.c:287:23: error: array subscript [3, 4] is outside array bounds of 'u8[16]' {aka 'unsigned char[16]'} [-Werror=array-bounds]
  287 |                 up[3] = tmp;
      |                 ~~~~~~^~~~~
arch/powerpc/lib/sstep.c: In function 'emulate_loadstore':
arch/powerpc/lib/sstep.c:681:11: note: at offset [24, 39] into object 'u' of size 16
  681 |         } u = {};
      |           ^
arch/powerpc/lib/sstep.c:681:11: note: at offset [24, 39] into object 'u' of size 16
arch/powerpc/lib/sstep.c:681:11: note: at offset [24, 39] into object 'u' of size 16
arch/powerpc/lib/sstep.c:681:11: note: at offset [24, 39] into object 'u' of size 16
arch/powerpc/lib/sstep.c:681:11: note: at offset [24, 39] into object 'u' of size 16
In function 'do_byte_reverse',
    inlined from 'do_vec_load' at arch/powerpc/lib/sstep.c:691:3,
    inlined from 'emulate_loadstore' at arch/powerpc/lib/sstep.c:3438:9:
arch/powerpc/lib/sstep.c:288:23: error: array subscript 2 is outside array bounds of 'u8[16]' {aka 'unsigned char[16]'} [-Werror=array-bounds]
  288 |                 tmp = byterev_8(up[2]);
      |                       ^~~~~~~~~~~~~~~~
arch/powerpc/lib/sstep.c: In function 'emulate_loadstore':
arch/powerpc/lib/sstep.c:681:11: note: at offset 16 into object 'u' of size 16
  681 |         } u = {};
      |           ^
arch/powerpc/lib/sstep.c:681:11: note: at offset 16 into object 'u' of size 16
arch/powerpc/lib/sstep.c:681:11: note: at offset 16 into object 'u' of size 16
arch/powerpc/lib/sstep.c:681:11: note: at offset 16 into object 'u' of size 16
arch/powerpc/lib/sstep.c:681:11: note: at offset 16 into object 'u' of size 16
In function 'do_byte_reverse',
    inlined from 'do_vec_load' at arch/powerpc/lib/sstep.c:691:3,
    inlined from 'emulate_loadstore' at arch/powerpc/lib/sstep.c:3438:9:
arch/powerpc/lib/sstep.c:289:23: error: array subscript 2 is outside array bounds of 'u8[16]' {aka 'unsigned char[16]'} [-Werror=array-bounds]
  289 |                 up[2] = byterev_8(up[1]);
      |                 ~~~~~~^~~~~~~~~~~~~~~~~~
arch/powerpc/lib/sstep.c: In function 'emulate_loadstore':
arch/powerpc/lib/sstep.c:681:11: note: at offset 16 into object 'u' of size 16
  681 |         } u = {};
      |           ^
arch/powerpc/lib/sstep.c:681:11: note: at offset 16 into object 'u' of size 16
arch/powerpc/lib/sstep.c:681:11: note: at offset 16 into object 'u' of size 16
arch/powerpc/lib/sstep.c:681:11: note: at offset 16 into object 'u' of size 16
arch/powerpc/lib/sstep.c:681:11: note: at offset 16 into object 'u' of size 16
  CC      arch/powerpc/kernel/jump_label.o
cc1: all warnings being treated as errors
make[2]: *** [scripts/Makefile.build:271: arch/powerpc/lib/sstep.o] Error 1

These errors above are unrelated to the patch.

[1]: https://lore.kernel.org/linuxppc-dev/20220531065936.3674348-1-mpe@ellerman.id.au/

Thanks.

-- 
An old man doll... just what I always wanted! - Clara


More information about the Linuxppc-dev mailing list