diff options
author | Abhishek Singh Tomar <abhishek@linux.ibm.com> | 2022-01-24 19:26:12 +0530 |
---|---|---|
committer | Cédric Le Goater <clg@kaod.org> | 2022-02-04 08:35:25 +0100 |
commit | a9bc782c843250a17255236acc210fbbe16ddf78 (patch) | |
tree | a1e47431d10c638dea932bc3574d38f4365e482e /include | |
parent | 095cef27f0f4aad58266516846e65363418cf7f1 (diff) | |
download | skiboot-a9bc782c843250a17255236acc210fbbe16ddf78.zip skiboot-a9bc782c843250a17255236acc210fbbe16ddf78.tar.gz skiboot-a9bc782c843250a17255236acc210fbbe16ddf78.tar.bz2 |
Fix array-bound compilation warnings
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@linux.ibm.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/compiler.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/compiler.h b/include/compiler.h index a9ccfae..77821ec 100644 --- a/include/compiler.h +++ b/include/compiler.h @@ -38,4 +38,16 @@ static inline void barrier(void) #define __tostr(x) #x #define tostr(x) __tostr(x) + +#if __GNUC__ >= 11 +/* Compiler workaround to avoid compiler optimization warnings + * when assigning constant address to pointer and using memory + * functions such as memcpy and memset + */ +#define skiboot_constant_addr volatile +#else +#define skiboot_constant_addr +#endif + + #endif /* __COMPILER_H */ |