Message ID | 20210729075438.652246-1-joel@jms.id.au |
---|---|
State | Accepted |
Headers | show |
Series | Makefile: Avoid errors with GCC 11 | expand |
On 7/29/21 1:24 PM, Joel Stanley wrote: > GCC's string and memory functions blow up as the compiler thinks the > objects have no size: > Thanks! Merged to master as 8246de86. -Vasant
diff --git a/Makefile.main b/Makefile.main index d21f27be3e0e..73e9de21431b 100644 --- a/Makefile.main +++ b/Makefile.main @@ -166,6 +166,8 @@ CFLAGS += $(call try-cflag,$(CC),-Wjump-misses-init) \ $(call try-cflag,$(CC),-Wno-error=suggest-attribute=const) \ $(call try-cflag,$(CC),-Wno-error=suggest-attribute=noreturn) \ $(call try-cflag,$(CC),-Wstack-usage=1024) \ + $(call try-cflag,$(CC),-Wno-error=array-bounds) \ + $(call try-cflag,$(CC),-Wno-error=stringop-overread) \ $(call try-cflag,$(CC),-Wno-error=address-of-packed-member) CFLAGS += $(CWARNS) $(OPTS) $(DBG)
GCC's string and memory functions blow up as the compiler thinks the objects have no size: core/opal-dump.c: In function ‘opal_mpipl_update’: libc/include/string.h:34:16: warning: ‘__builtin_memset’ offset [0, 32767] is out of the bounds [0, 0] [-Warray-bounds] 34 | #define memset __builtin_memset core/opal-dump.c:333:17: note: in expansion of macro ‘memset’ 333 | memset((void *)MDRT_TABLE_BASE, 0, MDRT_TABLE_SIZE); | ^~~~~~ core/opal-dump.c: In function ‘opal_mpipl_init’: libc/include/string.h:34:16: warning: ‘__builtin_memset’ offset [0, 1023] is out of the bounds [0, 0] [-Warray-bounds] 34 | #define memset __builtin_memset core/opal-dump.c:565:9: note: in expansion of macro ‘memset’ 565 | memset(mdst_base, 0, MDST_TABLE_SIZE); | ^~~~~~ libc/include/string.h:34:16: warning: ‘__builtin_memset’ offset [0, 1023] is out of the bounds [0, 0] [-Warray-bounds] 34 | #define memset __builtin_memset core/opal-dump.c:567:9: note: in expansion of macro ‘memset’ 567 | memset(mddt_base, 0, MDDT_TABLE_SIZE); | ^~~~~~ In function ‘HDIF_check’, inlined from ‘fixup_spira’ at hdata/spira.c:1679:7, inlined from ‘parse_hdat’ at hdata/spira.c:1732:2: libc/include/string.h:38:16: warning: ‘__builtin_memcmp’ specified bound 6 exceeds source size 0 [-Wstringop-overread] 38 | #define memcmp __builtin_memcmp hdata/hdif.h:71:17: note: in expansion of macro ‘memcmp’ 71 | memcmp(hdr->id, id, sizeof(hdr->id)) == 0; | ^~~~~~ This turns the errors into warnings so the build can complete. Signed-off-by: Joel Stanley <joel@jms.id.au> --- Makefile.main | 2 ++ 1 file changed, 2 insertions(+)