To: J3 J3/21-151 From: Malcolm Cohen Subject: Interp F18/031 CO_BROADCAST with polymorphic argument Date: 2021-June-20 ---------------------------------------------------------------------- NUMBER: F18/031 TITLE: CO_BROADCAST with polymorphic argument DEFECT TYPE: Erratum STATUS: J3 consideration in progress 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. ALTERNATIVE ANSWER: Yes, this was intended to be conforming. An edit is supplied with the missing semantics. 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." ALTERNATIVE EDIT to 18-007r1: [355:21] 16.9.46 CO_BROADCAST, p3 Arguments, argument A, Change "as if by intrinsic assignment" to "as if by an intrinsic assignment statement where the variable and expression are both nonpolymorphic with their declared type and type parameters equal to the dynamic type and type parameters of A". SUBMITTED BY: Malcolm Cohen HISTORY: 21-nnn m224 Submitted ----------------------------------------------------------------------