The source of these test failure is LTO: it built fine with GCC 10.3 with LTO a month ago on buildd, GCC 11 without LTO works and Clang 13 with LTO also works. So either there is some subtle undefined behaviour in dovecot (which gets miscompiled) or the code generation in GCC 11 is buggy (maybe related [1]).
For the mean time the simplest solution is probably to disable LTO (or switch to building with Clang?). [1]: https://bugs.gentoo.org/show_bug.cgi?id=787158