Difference between automatic arrays on the heap and allocatable arrays

But then you will likely duplicate a lot of code depending on which one is used, or you will use a pointer to avoid the duplication, which is not fully satisfactory either.

I agree. But when releasing source code, you have no control on which compiler (a “good one” or not) will be used