https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120929
--- Comment #10 from qinzhao at gcc dot gnu.org --- (In reply to Sergei Trofimovich from comment #7) > > Crashing: > > $ gcc/xgcc -Bgcc -D_FORTIFY_SOURCE=3 -O1 apprentice.c -o bug && ./bug > In file included from /usr/include/string.h:548, > from apprentice.c:4: > In function 'memcpy', > inlined from 'coalesce_entries' at apprentice.c:30:9, > inlined from 'apprentice_load' at apprentice.c:59:3: > /usr/include/bits/string_fortified.h:29:10: warning: > '__builtin___memcpy_chk' writing 9 bytes into a region of size 8 overflows > the destination [-Wstringop-overflow=] > 29 | return __builtin___memcpy_chk (__dest, __src, __len, > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 30 | __glibc_objsize0 (__dest)); > | ~~~~~~~~~~~~~~~~~~~~~~~~~~ > *** buffer overflow detected ***: terminated > Aborted (core dumped) > thanks a lot for the testing case. I tried it on both X86 and aarch64 machines, but get different behavior: 1. on aarch64, I can repeat the exactly same issue with the testing case: with my latest trunk gcc, the testing case failed; However, with an earlier gcc, the testing case passed. 2. However on X86, even with the earlier gcc, I can repeat the exactly same failure. So, I am wondering whether you see such behavior only on aarch64 machine? Did you try it on X86? what's the behavior on X86?