[Skiboot] [PATCH v3] Fix array-bound compilation warnings

Joel Stanley joel at jms.id.au
Tue Apr 5 22:47:45 AEST 2022


On Fri, 4 Feb 2022 at 12:33, Cédric Le Goater <clg at kaod.org> wrote:
>
> On 1/24/22 14:56, Abhishek Singh Tomar wrote:
> > Resolves : the warray bounds warning during compilation
> >
> > /build/libc/include/string.h:34:16: warning: '__builtin_memset' offset [0, 2097151] is out of the bounds [0, 0] [-Warray-bounds]
> > 34 | #define memset __builtin_memset
> > hw/fsp/fsp.c:1855:9: note: in expansion of macro 'memset'
> > 1855 | memset(fsp_tce_table, 0, PSI_TCE_TABLE_SIZE);
> >
> > use volatile pointer to avoid optimization introduced with gcc-11 on constant
> > address assignment to pointer.
> >
> > Signed-off-by: Abhishek Singh Tomar <abhishek at linux.ibm.com>
>
> It might not be the definitive solution but it does remove all the warnings
> we have been seeing lately.

It appears that this behavior has been changed in GCC 12, and
backported to GCC 11:

 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578

Assuming the cases in this patch are the same as those silenced by the
change, we should consider reverting the patch once the updated
compiler is released and available.


More information about the Skiboot mailing list