mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-18 21:27:56 +00:00
Prevent false warnings in memcpy (GCC 12)
GCC 12 tree-loop-distribute-patterns generates false warnings of -Warray-bounds, -Wstringop-overflow, or -Wstringop-overread in memcpy() and memcpy_cpu() in static/inline cases for code that obviously prevents its execution by invariant checking. On -O3, even more warnings are produced.
This commit is contained in:
parent
010847b69c
commit
1d73cf2003
@ -25,7 +25,10 @@ namespace Genode {
|
||||
* \param size number of bytes to copy
|
||||
*
|
||||
* \return number of bytes not copied
|
||||
*
|
||||
* The compiler attribute prevents array-bounds warnings with gcc 12.3.
|
||||
*/
|
||||
__attribute((optimize("no-tree-loop-distribute-patterns")))
|
||||
inline size_t memcpy_cpu(void * dst, const void * src, size_t size)
|
||||
{
|
||||
using word_t = unsigned long;
|
||||
|
@ -190,6 +190,9 @@ namespace Genode {
|
||||
*/
|
||||
inline void *memcpy(void *dst, const void *src, size_t size)
|
||||
{
|
||||
if (!size)
|
||||
return dst;
|
||||
|
||||
char *d = (char *)dst, *s = (char *)src;
|
||||
size_t i;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user