mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2026-07-04 03:08:39 +00:00
GCC11 has a bug where it may produce an incorrect warning "writing 1 or more bytes into a region of size 0 overflows the destination" when using memcpy and memset [0]. Since we use -Werror, this warning is fatal and prevents building certain configurations with GCC11. Enabling LTO makes the problem worse as the compiler has more visibility to do a wider analysis. This patch fixes this by using syntactic assignment rather than library functions in the places that most often cause problems. GCC11 is able to correctly analyse those scenarios and does not emit a warning. There is a slight upside to this in that it may be able to produce more optimal code. [0]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106199 Change-Id: I897e6360b8619ba1d4587d3abf84ffdd31f17273 Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com>