Is pointing to a target dummy argument safe after return?

@RonShepard That’s a very good essence, thanks. Funny enough, if I could formulate so concise, I would have written almost exactly the same summary for my line of arguments :smile:

The intent(in),pointer declaration prevents me from making certain mistakes, and it does so at compile time, which is the best time to detect errors. The intent(in), target declaration allows those mistakes, without warning, either at compile time or (often also) at run time.

Your approach prefers to avoid changing a value by mistake without the compiler warning you. On the other hand, you allow for the mistake of forgetting the target attribute for the passed argument (or of passing a vector subscripted array) and obtaining an invalid pointer as a consequence without a compile time warning (at least with current production compilers).

I prefer to avoid the mistake of obtaining an invalid pointer (which can cause indeterministic segfaults and other hard to debug symptoms), but concede the unintended change of a variable within a routine. I find latter easier to track down. Additionally, once you allow a pointer to point to an object, you basically give up the access control for this object anyway, as pointer-constantness does not exist in Fortran (yet).

So, at the end, this is a matter of taste choice with both approaches having some pros and cons, I guess.