N2167 UK PROPOSALS FOR REVISION OF FORTRAN 2018 SUBMITTED TO WG5, AUGUST 2019 The BSI Fortran panel wishes to submit the following proposals for the revision of Fortran 2018 for consideration by WG5. General Principles There is concern that vendor implementation of F2008 is still relatively sparse. This means that authors of portable code must stay within the common subset of what is available to them, negating much of the value of the standard. We therefore have the view that this revision should to a minor one to allow vendors time to produce processors that conform more closely to the standard. Exception handling was raised in both recent user surveys. The consensus in the BSI panel is that exception handling is too large and complicated a subject to incorporate at this stage. Templates, in some form, was the other main topic requested in the surveys. However the addition of templates would have a very significant impact on the standard and would require substantial implementation resource. Macros (cf item US24 in N2165) have been proposed and discussed as an alternative which would provide some 80% to 90% of the facilities provided by templates; macros would be easier to integrate both into the standard and into current processors. However the panel has not been able to reach consensus on whether this revision (a) should allow only minor extensions, corrections and clarifications or (b) should also include one of templates or macros. Hence panel members look forward to further discussion at the August WG5 meeting. Since they have been regularly requested over the years, and are relatively minor, if neither templates nor macros are judged to be acceptable the panel would support the introduction of conditional expressions. That is we would support the development of the proposal in PL22.3 paper 18-274 (cf item US22 in N2165). We also propose a minor extension to allow specification of pointer lower bounds in C_F_POINTER to bring it into line with pointer assignment more generally (cf subclause 10.2.2). Detailed Proposal ------------------------------------------------------------------- Number: UK-01 Title: C_F_POINTER Submitted by: UK Status: For consideration Basic Functionality: Extend procedure C_F_POINTER to allow a Fortran array pointer to have lower bounds other than 1. Rationale: Pointer assignment allows the lower bound of aa array pointer to be specified but intrinsic subroutine C_F_POINTER does not. This change brings the two into line and saves the introduction of a new pointer to achieve the effect. Specification (relative to WG5-N2162): Subclause 18.2.3.3 C_F_POINTER (CPTR, FPTR [, SHAPE]) In the heading of the subclause, after '[,SHAPE] add '[, LOWER_BOUNDS] so that the line reads: 18.2.3.3 C_F_POINTER (CPTR, FPTR [, SHAPE] [, LOWER_BOUNDS]) In paragraph 3 (Arguments), the definition of FPTR, replace "and each lower bound is equal to 1." by "; the lower bounds are specified by LOWER_BOUNDS if it is present and otherwise are all equal to 1." so that the sentence becomes "If FPTR is an array, its shape is specified by SHAPE; the lower bounds are specified by LOWER_BOUNDS if it is present and otherwise are all equal to 1." In Case (iii), sentence 2 delete "and each lower bound is 1" so that the sentence becomes "If FPTR is an array, its shape is specified by SHAPE." After the definition of SHAPE, add: LOWER_BOUNDS (optional) shall be a rank-one integer array. It is an INTENT (IN) argument. LOWER_BOUNDS shall be present only if SHAPE is present and shall be of the same size as SHAPE. In paragraph 4 (Examples), replace Case (ii) by: Type t Real, Allocatable :: v(:,:) End Type Type(t), Target :: x(0:2) Type(C_ptr) :: xloc xloc = C_Loc (x) ... Type(t), Pointer :: y (:) Call C_F_Pointer (xloc, y, [3], [0]) end -------------------------------------------------------------------