I had dovecot in version 2.2.35 installed and an upgrade would have upgraded it to 2.3.x. So I locked dovecot. Then I built dovecot22 on my poudriere and did a "pkg install dovecot22". And pkg segfaulted.
After I unlocked dovecot, I could install dovecot22 and dovecot got removed.