mirror of
https://github.com/matrix-construct/construct
synced 2024-12-25 23:14:13 +01:00
ircd::buffer: Suppress errant array/stringop-overflow in debug+assert mode.
This commit is contained in:
parent
c78ab62227
commit
f8538d3c5b
1 changed files with 11 additions and 0 deletions
|
@ -85,7 +85,18 @@ ircd::buffer::copy(char *&__restrict__ dest,
|
||||||
assert(!overlap(const_buffer(dest, cpsz), src));
|
assert(!overlap(const_buffer(dest, cpsz), src));
|
||||||
assert(cpsz <= size(src));
|
assert(cpsz <= size(src));
|
||||||
assert(cpsz <= remain);
|
assert(cpsz <= remain);
|
||||||
|
|
||||||
|
// Suppress warnings which present from the __builtin_memcpy() but these
|
||||||
|
// are actually caused by the overlap assertion above which should have no
|
||||||
|
// side-effects; this is very likely a bug in gcc.
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#ifdef RB_ASSERT
|
||||||
|
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||||
|
#pragma GCC diagnostic ignored "-Wstringop-overflow"
|
||||||
|
#endif
|
||||||
__builtin_memcpy(dest, srcp, cpsz);
|
__builtin_memcpy(dest, srcp, cpsz);
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
dest += cpsz;
|
dest += cpsz;
|
||||||
assert(dest <= stop);
|
assert(dest <= stop);
|
||||||
return dest;
|
return dest;
|
||||||
|
|
Loading…
Reference in a new issue