Does this program conform to the standard?

No, it is not standard conforming.

  1. You have a temporary expression, which does not exist after the call.
  2. Pointers to a target dummy arguments are invalid after the end of the routine, if the actual argument did not have the target attribute. (See among others the discussion Is pointing to a target dummy argument safe after return?)

Actually, turning your dummy argument integer, target :: a into integer, pointer, intent(in) :: a would have triggered a meaningful error message… But again, as you can see on the long discussion referenced above (read maybe the short summary in Is pointing to a target dummy argument safe after return? - #28 by aradi), it is a personal preference, whether one likes the automatic conversion of target actual arguments into pointer dummies or not.

1 Like