To: J3 J3/22-100 From: John Reid Subject: F18/031 revised Date: 2021-December-06 References: 18-007r1, 21-173, 21-184r1 Discussion --------- Interp F18/031 failed the letter ballot (see 21-184r1). The reason for my NO vote was faulty, see the comments of /interp in 21-184r1. After further discussion by /HPC and /interp, I wish to propose two alternatives: A. The response in 21-173, which does not permit the argument A to be polymorphic. An additional small edit is proposed. B. The suggestion in my ballot. The argument A is not permitted to be nonallocatable polymorpic. For alternative A, the additional edit I suggest is [355:19] 16.9.46 CO_BROADCAST, p3 Arguments, argument A, sentence 1, delete "dynamic" to make the sentence read "A shall have the same shape, type, and type parameter values, in corresponding references." I think it is misleading to the reader to talk of "dynamic type" when A cannot be polymorphic. For alternative B, note that intrinsic assignment (18-007r1, 10.2.1.2) has the requirement (1) if the variable is polymorphic it shall be allocatable and not a coarray, which means that intrinsic assignment for a noncorray polymorphic variable does not conform with the standard unless the variable is allocatable. As the interp. points out, it seems strange to allow polymorphic broadcast across images, but not to allow polymorphic assignment of a single variable within an image. The proposed edits align CO_BROADCAST with intrinsic assignment. Note also that CO_BROADCAST has the requirement A shall have the same shape, dynamic type, and type parameter values, in corresponding references. which implies that A is permitted to be polymorphic. If it is allocatable, is not a coarray, and the above conditions hold, A becomes defined on each image as if by intrinsic assignment. Because no reallocation is needed or intended, the "not a coarray" condition is not needed here. An edit to specify this is included. I prefer alternative B. I see alternative A as an unnecessary restriction on the use of polymorphic variables. ---------------------------------------------------------------------- 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: Alternative A No, this was not intended to be conforming. Edits are supplied to correct this. EDITS to 18-007r1: [355:19] 16.9.46 CO_BROADCAST, p3 Arguments, argument A, sentence 1, delete "dynamic" to make the sentence read "A shall have the same shape, type, and type parameter values, in corresponding references." [355:20] 16.9.46 CO_BROADCAST, p3 Arguments, argument A, sentence 2, after "It shall not be" insert "polymorphic or" making the sentence read "It shall not be polymorphic or a coindexed object." Alternative B No, this was not intended to be conforming. Edits are supplied to correct this. EDITS to 18-007r1: [355:20] 16.9.46 CO_BROADCAST, p3 Arguments, argument A, sentence 2, after "It shall not be" insert "nonallocatable polymorphic or" making that sentence read "It shall not be nonallocatable polymorphic or a coindexed object." [355:21] 16.9.46 CO_BROADCAST, p3 Arguments, argument A, final sentence, after "intrinsic assignment", add "for a noncoarray variable" making that sentence read "If no error condition occurs, A becomes defined, as if by intrinsic assignment for a noncoarray variable, on all images in the current team with the value of A on image SOURCE_IMAGE." SUBMITTED BY: Malcolm Cohen HISTORY: 21-151 m224 Submitted 21-151r1 m224 Eliminated alternative answer, passed by J3 meeting 224. 21-184r1 m225 Failed J3 letter ballot.