To: J3 J3/21-151r1 From: Malcolm Cohen Subject: Interp F18/031 CO_BROADCAST with polymorphic argument Date: 2021-July-01 ---------------------------------------------------------------------- NUMBER: F18/031 TITLE: CO_BROADCAST with polymorphic argument DEFECT TYPE: Erratum STATUS: Passed by J3 meeting QUESTION: Consider the code fragment Subroutine asgn_for_image(a,b,srcimg) Class(*) a,b Integer,Intent(In) :: srcimg ! The assignment A = B is not allowed, so... If (This_Image()==srcimg) Then Call asgn(b) Else Call asgn(a) End If Contains Subroutine asgn(x) Class(*) x Call co_broadcast(x,Source_Image=srcimg) End Subroutine End Subroutine There is no requirement forbidding the A argument of CO_BROADCAST from being polymorphic, so on the face of it, this appears to get around the prohibition against nonallocatable polymorphic assignment. However, CO_BROADCAST states "A becomes defined, as if by intrinsic assignment" but intrinsic assignment is not defined when the variable is a nonallocatable polymorphic. It can be convincingly argued that the standard therefore does not establish an interpretation, and thus the call to CO_BROADCAST is not valid. Philosophically, it would seem to be strange to allow polymorphic broadcast across images, but not to allow polymorphic assignment of a single variable within an image let alone across images. Is the call to CO_BROADCAST in the example standard-conforming? (And if so, what are the actual semantics?) ANSWER: No, this was not intended to be conforming. An edit is supplied with the missing requirement. EDIT to 18-007r1: [355:20] 16.9.46 CO_BROADCAST, p3 Arguments, argument A, After "It shall not be" Insert "polymorphic or" Making that sentence read "It shall not be polymorphic or a coindexed object." SUBMITTED BY: Malcolm Cohen HISTORY: 21-151 m224 Submitted 21-151r1 m224 Eliminated alternative answer. ----------------------------------------------------------------------