mirror of
https://github.com/mmueller41/genode.git
synced 2026-01-21 12:32:56 +01: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:
@@ -130,7 +130,7 @@ namespace Genode {
|
||||
/**
|
||||
* Return length of null-terminated string in bytes
|
||||
*/
|
||||
__attribute((optimize("no-tree-loop-distribute-patterns")))
|
||||
__attribute((optimize("no-tree-loop-distribute-patterns")))
|
||||
inline size_t strlen(const char *s)
|
||||
{
|
||||
size_t res = 0;
|
||||
@@ -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;
|
||||
|
||||
@@ -281,7 +284,7 @@ namespace Genode {
|
||||
* generation of a 'memset()' call in the 'while' loop
|
||||
* with gcc 10.
|
||||
*/
|
||||
__attribute((optimize("no-tree-loop-distribute-patterns")))
|
||||
__attribute((optimize("no-tree-loop-distribute-patterns")))
|
||||
inline void *memset(void *dst, uint8_t i, size_t size)
|
||||
{
|
||||
using word_t = unsigned long;
|
||||
|
||||
Reference in New Issue
Block a user