https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109120
--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> --- Thanks for filing this bug. Seems to affect GCC 11 onwards, as GCC 10 didn't support the 2nd argument to __attribute__((malloc)): Trunk: https://godbolt.org/z/MbWezaxrz GCC 12.2: https://godbolt.org/z/vW1ae44Eb GCC 11.3: https://godbolt.org/z/n9fzx8376