J3/17-155r1 To: J3 From: Van Snyder and Malcolm Cohen Subject: C856 overlooks three things, and prohibits an impossibility Date: 2017 June 27 1. Introduction The treatment of PROTECTED TARGET variables in the standard is not consistent, in the following ways: (1) C856 prohibits a nonpointer data object from being a proc-target, but there are no such objects. (2) C856 explicitly prohibits it from being a data-target in a pointer assignment statement, but only indirectly prohibits it from being a data-target in a structure constructor (and this is not a constraint). (3) C856 prohibits it from being a data target everywhere except as an initial-data-target. This is obviously not what we intended; the PROTECTED variable is not definable, so the pointer is also not definable until a pointer assignment or allocation is done, but the Fortran processor is unlikely to be able to diagnose this. Although (2) is an inconsistency in whether the requirement is required to be diagnosed (because one case is not a constraint), this is not a significant technical flaw. However, (3) is an obvious mistake. Something should be done. Fixing this would be an incompatibility with Fortran 2008, but fixing it now would be less work that fixing it via the interp process. 2. WG5 Straw votes Do we want to prohibit a PROTECTED TARGET as an initial-data-target? Do we want to make the prohibition as a data-target in a structure constructor into a constraint instead of a plain requirement? 3. Edits to N2123 (17-007r1) #if (both straw votes = Yes) then [xviii] Introduction, Data declaration, append new sentence "Diagnosis of a PROTECTED TARGET variable accessed by use association as a in a structure constructor is required." {New constraint.} [31:3+] 4.3.3 Fortran 2008 compatibility, p5+, add new paragraph "Fortran 2008 permitted a PROTECTED TARGET variable accessed by use association to be used as an ; this document does not permit that." {Incompatibility.} [111:7] 8.5.15 PROTECTED attribute, C856, Change "as the data-target or proc-target in a pointer-assignment-stmt" to "as a data-target or initial-data-target". {Prohibit protected targets everywhere we intended.} #else if (first straw vote = Yes .and. second straw vote = No) then [31:3+] 4.3.3 Fortran 2008 compatibility, p5+, add new paragraph "Fortran 2008 permitted a PROTECTED TARGET variable accessed by use association to be used as an ; this document does not permit that." {Incompatibility.} [111:7] 8.5.15 PROTECTED attribute, C856, Change "as the data-target or proc-target in a pointer-assignment-stmt" to "as an initial-data-target or the data-target in a pointer-assignment-stmt". {Prohibit protected targets everywhere we intended, but not as a constraint in the structure constructor case.} #else if (both straw votes = No) then [111:7] 8.5.15 PROTECTED attribute, C856, Delete "or ". {Leave it broken w.r.t. initial-data-target, but do the editorial fix.} #endif ===END===