Fix stringop-overread errors with gcc 12.1.0
(cherry picked from commit 452d01c8)
Compiling fails with stringop-overread errors on gcc 12.1.0. I attached the output from trying to compile the master branch with a simple configuration (2D, sphenix scheme, debug-checks).
Edited by Yolan Uyttenhove