op-build
op-build copied to clipboard
hcode-p10-hw032322a.opmst10 fails to build
Building on a rhel9 x86_64 host:
../../import/tools/imageProcs//ipl_image_tool.C: In function ‘void dumpHeader(void*, image_section_type_t)’:
../../import/tools/imageProcs//ipl_image_tool.C:947:31: error: array subscript ‘uint64_t {aka long unsigned int}[0]’ is partly outside array bounds of ‘unsigned char [4]’ [-Werror=array-bounds]
947 | printf("%016lx ", *(uint64_t*)(val64 + j));
| ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../import/tools/imageProcs//ipl_image_tool.C:942:47: note: referencing an object of size 4 allocated by ‘void* malloc(size_t)’
942 | val64 = (uint64_t*)(malloc(sizeof(8 * numOf64BitsSet)));
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Can be reproduced by building locally with O3:
$ g++ -Wall -O3 -DOPENPOWER_BUILD=1 -I./import/chips/p10/utils/imageProcs/ -I./import/chips/common/utils/imageProcs/ -I./import/hwpf/prcd/ -c ./import/tools/imageProcs/ipl_image_tool.C
--- a/import/tools/imageProcs/ipl_image_tool.C
+++ b/import/tools/imageProcs/ipl_image_tool.C
@@ -939,7 +939,7 @@ dumpHeader(void* i_image, image_section_type_t i_imageSectionType)
printf(" %04d ", val);
//Get service bit vector
- val64 = (uint64_t*)(malloc(sizeof(8 * numOf64BitsSet)));
+ val64 = (uint64_t*)(malloc(sizeof(uint64_t) * numOf64BitsSet));
dynamic_get_bitVector_perValue(i_image, i, val64);
for ( j = 0; j < numOf64BitsSet; j++ )
I put the fix up internally: https://rchgit01.rchland.ibm.com/gerrit1/129328