It works with Intel ifx 2022.1.0, under Ubuntu 22.04:
err is allocated
next line tries to print err
a bigger than 2
But with GFortran 11.2.0, err is not printed (or is empty):
err is allocated
next line tries to print err
But no segfault.