From owner-sc22wg5+sc22wg5-dom8=www.open-std.org@open-std.org  Fri Aug  3 13:14:04 2012
Return-Path: <owner-sc22wg5+sc22wg5-dom8=www.open-std.org@open-std.org>
X-Original-To: sc22wg5-dom8
Delivered-To: sc22wg5-dom8@www.open-std.org
Received: by www.open-std.org (Postfix, from userid 521)
	id 1CD6C3568C8; Fri,  3 Aug 2012 13:14:04 +0200 (CEST)
Delivered-To: sc22wg5@open-std.org
Received: from mk-filter-3-a-1.mail.uk.tiscali.com (mk-filter-3-a-1.mail.tiscali.co.uk [212.74.100.54])
	by www.open-std.org (Postfix) with ESMTP id A667C3568A4
	for <sc22wg5@open-std.org>; Fri,  3 Aug 2012 13:14:01 +0200 (CEST)
X-Trace: 789541234/mk-filter-3.mail.uk.tiscali.com/B2C/$THROTTLED_STATIC/TalkTalk_Customer/92.21.164.243/None/John.Reid@stfc.ac.uk
X-SBRS: None
X-RemoteIP: 92.21.164.243
X-IP-MAIL-FROM: John.Reid@stfc.ac.uk
X-SMTP-AUTH: 
X-Originating-Country: GB/UNITED KINGDOM
X-MUA: Mozilla/5.0 (Windows NT 5.1;
 rv:14.0) Gecko/20120715 Firefox/14.0.1 SeaMonkey/2.11
X-IP-BHB: Once
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: ApMBAL6xG1BcFaTz/2dsb2JhbAANOItasRYBDCwfAgQ9FhgDAgECAUsKAwYCAheGAKpWiwOJBItHFAEGBYZkA45XgSCFUYVIjSWBVQE
X-IronPort-AV: E=Sophos;i="4.77,706,1336345200"; 
   d="txt'?scan'208";a="789541234"
Received: from host-92-21-164-243.as13285.net (HELO [127.0.0.1]) ([92.21.164.243])
  by smtp.tiscali.co.uk with ESMTP; 03 Aug 2012 12:12:58 +0100
Message-ID: <501BB236.4000004@stfc.ac.uk>
Date: Fri, 03 Aug 2012 12:12:54 +0100
From: John Reid <John.Reid@stfc.ac.uk>
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20120715 Firefox/14.0.1 SeaMonkey/2.11
MIME-Version: 1.0
To: WG5 <sc22wg5@open-std.org>
Subject: Third WG5 ballot on interpretations
Content-Type: multipart/mixed;
 boundary="------------050004020502090409080609"
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

This is a multi-part message in MIME format.
--------------050004020502090409080609
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

WG5,

Here are

N1932 Fortran Interpretations ready for WG5 (Cohen)
N1933 WG5 letter ballot 3 on Fortran 2008 interpretations (Reid)

N1932 has been ready since July 20. I have delayed issuing it and the 
ballot on its first half because of the outage of the J3 server. As last 
year, I have divided the ballot into two to avoid a huge single ballot. 
Both ballots are for 4 weeks. The second ballot, N1934 will start in 4 
weeks time.

Best wishes,

John.

--------------050004020502090409080609
Content-Type: text/plain; charset=windows-1252;
 name="N1933.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="N1933.txt"

                                           ISO/IEC JTC1/SC22/WG5 N1933

          WG5 letter ballot 3 on Fortran 2008 interpretations
                      John Reid, 3 August 2012

This is the third WG5 vote on a set of draft interpretations for Fortran 
2008. They have all been approved in a J3 letter ballot.  

The rules we operate on say:
--- ---
4. The chair of J3/interp gathers all interp answers that are marked
   "passed by J3 letter ballot" and forwards them to the WG5 convenor.
   The WG5 convenor holds a ballot of individual members; a no vote
   must be accompanied by an explanation of the changes necessary to
   change the member's vote to yes. The answers that pass this ballot
   become "WG5 approved".

   J3/interp reserves the right to recall an interp answer for more
   study even if the answer passes.

5. "WG5 approved" answers are processed into a corrigendum document by
   taking the edits from the interp answers and putting them in the
   format required by ISO.  A WG5 vote is made on forwarding the
   corrigendum to SC22.

The following Fortran 2003 interpretations are being balloted:

Yes  No Number     Title
---  ---  F03/0017   Dummy procedure pointers and PRESENT
---  ---  F03/0018   Multiple identical specific procedures in
                      type-bound generic interfaces
---  ---  F03/0019   Multiple identical specific procedures in
                      generic interface blocks
---  ---  F03/0021   What kind of token is a stop code?
---  ---  F03/0046   Unlimited polymorphic pointers in
                      common blocks
---  ---  F03/0053   The BIND attribute for C_PTR and C_FUNPTR
---  ---  F03/0065   Relational equivalence
---  ---  F03/0084   IEEE_SET_ROUNDING_MODE in a subroutine
---  ---  F03/0096   Can a read statement change the unit value?
---  ---  F03/0103   Restrictions on dummy arguments not present for
                      polymorphic type or parameterized derived type
---  ---  F03/0116   indistinguishable specifics for a generic
                      interface with use association
---  ---  F03/0118   Are lower bounds of assumed-shape arrays assumed?
---  ---  F03/0120   When are parameterized sequence types the same
                      type?
---  ---  F03/0121   Precise FP semantics of the REAL intrinsic
---  ---  F08/0004   Is TARGET argument of ASSOCIATED a pointer or
                      nonpointer dummy?
---  ---  F08/0008   IEEE exceptions for intrinsic functions
---  ---  F08/0031   PURE INTENT(OUT) finalization
---  ---  F08/0032   PURE FUNCTION result finalization
---  ---  F08/0038   Are pointless restrictions on DIM arguments
                      intended?
---  ---  F08/0040   MOVE_ALLOC for coarrays
---  ---  F08/0042   SOURCE= questions

The text of these interpretations is in N1932.  Each interpretation starts 
there with a row of "-"s.

Please mark the above -Y- in the Yes column for "yes", -C- in the Yes
column for "yes with comment", or -N- in the No column for a "no"
answer {be sure to include your reasons with "no"} and send to

        sc22wg5@open-std.org

by 0900 UK time on Friday, 31 August 2012, in order to be counted.

Thanks,

John.                         

--------------050004020502090409080609
Content-Type: text/plain; charset=windows-1252;
 name="N1932.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="N1932.txt"


                                         ISO/IEC JTC1/SC22/WG5 N1932

      Fortran Interpretations ready for WG5, July 20, 2012

                           Malcolm Cohen
                             
[keep this text document to 70 characters per line]...................

----------------------------------------------------------------------

NUMBER: F03/0017
TITLE: Dummy procedure pointers and PRESENT
KEYWORDS: Dummy argument, procedure pointer, PRESENT
DEFECT TYPE: Interpretation
STATUS: Passed by J3 letter ballot

QUESTION:

Does the following program conform to the Fortran standard?

  procedure(real), pointer :: F => null()
  call s ( f )
  contains
    subroutine S ( F )
      procedure(real), optional, pointer :: F
      print *, present(f)
    end subroutine S
  end

In the Fortran 2003 standard (ISO/IEC 1539-1:2004), the second
paragraph of 12.4.1.3 requires that if the dummy argument does not
have the POINTER attribute and the actual argument does, the actual
argument shall be associated.  It is not clear in 13.7.91 whether the
argument of PRESENT has or has not the POINTER attribute.

ANSWER:

The program is standard-conforming.

The Fortran 2008 standard states
  "Except in references to intrinsic inquiry functions, a pointer
   actual argument that corresponds to a nonoptional nonpointer dummy
   argument shall be pointer associated with a target."
(12.5.2.3 paragraph 1).

Since PRESENT is an intrinsic inquiry function, there is therefore no
requirement on its actual argument that if it is a pointer it shall be
associated.

EDITS to 10-007r1:

None.

SUBMITTED BY: Van Snyder

HISTORY: 04-402    m170  F03/0017 submitted
         04-402r2  m170  Passed by J3 meeting
         05-146    m171  Failed J3 letter ballot #10
         11-213    m195  Revised answer - Passed by J3 meeting
         11-241    m196  Passed by J3 letter ballot #24 11-229
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

----------------------------------------------------------------------

NUMBER: F03/0018
TITLE: Multiple identical specific procedures in type-bound generic
KEYWORDS: Type-bound generic
DEFECT TYPE: Clarification
STATUS: Passed by J3 letter ballot

QUESTION:

Q1. Does the following program unit conform to the Fortran standard?

  module M1
    type T
      integer x
    contains
      procedure :: MyAdd_t => myadd
      generic :: operator(+) => myAdd_t
    end type T
    type X
      real q
    contains
      procedure, pass(b) :: MyAdd_x => myadd
      generic :: operator(+) => myAdd_x
    end type X
  contains
    integer function MyAdd ( A, B )
      class(t), intent(in) :: A
      class(x), intent(in) :: B
      myadd = a%x + b%q
    end function MyAdd
  end module

Q2. Does the following program unit conform to the Fortran standard?

  module M2
    interface operator(+)
      procedure MyAdd
    end interface
    type T
      integer x
    contains
      procedure :: MyAdd_t => myadd
      generic :: operator(+) => myAdd_t
    end type T
  contains
    integer function MyAdd ( A, B )
      class(t), intent(in) :: A
      real, intent(in) :: B
      myadd = a%x + b
    end function MyAdd
  end module

Q3. If the interface block and type definition are exchanged in
    question 2, does the program unit conform to the Fortran standard?

ANSWER:

A1. The program unit is not standard-conforming.  Generic operator (+)
    has two ambiguous specific bindings, one to myadd_t the other to
    myadd_x.

A2. The program unit is not standard-conforming.  Generic operator (+)
    has two ambiguous specific procedures, one being the module
    procedure myadd the other being the type-bound procedure myadd_t.

A3. The ordering of the interface block and the type definition is
    immaterial.

EDITS to 10-007r1:

None

SUBMITTED BY:  Van Snyder

HISTORY: 04-405    m170  F03/0018 submitted
         04-405r1  m170  Passed by J3 meeting
         05-146    m171  Passed J3 letter ballot #10
         N1658     m176  Failed WG5 ballot N1657
         11-214    m195  Revised answer - Passed by J3 meeting
         11-241    m196  Passed by J3 letter ballot #24 11-229
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

----------------------------------------------------------------------

NUMBER: F03/0019
TITLE: Multiple identical specific procedures in generic interface
       blocks
KEYWORDS: Type-bound generics
DEFECT TYPE: Erratum
STATUS: Passed by J3 letter ballot

QUESTION:

Consider
  Module m12
    Interface g1
      Subroutine s
      End
    End Interface
    Interface g2
      Procedure s
    End Interface
  End Module
  Program p12
    Use m12
    Interface g1     ! (1)
      Procedure s
    End Interface
    Interface g2     ! (2)
      Procedure s
    End Interface
    Call g1
    Call g2
  End Program

It is clear that the interface block marked (2) is not conforming,
since it violates C1209 which says
  "A procedure-name shall not specify a procedure that is specified
   previously in any procedure-stmt in any accessible interface with
   the same generic identifier."

However, it is not clear whether the interface block marked (1) is
conforming, since s was specified previously by an interface-body not
a procedure-stmt, even though both (1) and (2) attempt to do the same
thing, viz create a generic interface with a duplicate specific.

An even more obscure example is
  Module mx12
    Interface g3
      Subroutine s
      End
    End Interface
    Private s
  End
  Program px12
    Use mx12
    Interface g3
      Subroutine s
      End
    End Interface
    Call g3
  End Program

Here there is clearly no violation of C1209 but it is not obvious
whether the ambiguity rules are applied or not.

ANSWER:

These examples were not intended to be conforming.
An edit is supplied to clarify.

EDITS to 10-007r1:

[281:11-12] Replace C1209 entirely by
  "C1209 (R1201) An <interface-specification> in a generic interface
         block shall not specify a procedure that is specified
         previously in any accessible interface with the same generic
         identifier."

SUBMITTED BY:  Van Snyder

HISTORY: 04-406    m170  F03/0019 submitted
         04-406r1  m170  Passed by J3 meeting
         05-146    m171  Passed J3 letter ballot #10
         N1658     m176  Failed WG5 ballot N1657
         11-221    m195  Revised answer - Passed by J3 meeting
         11-241    m196  Passed by J3 letter ballot #24 11-229
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

----------------------------------------------------------------------

NUMBER: F03/0021
TITLE: What kind of token is a stop code?
KEYWORDS: STOP, token
DEFECT TYPE: Erratum
STATUS: Passed by J3 letter ballot

QUESTION:

The <stop-code>, when it is a string of <digit>s, does not appear to
be specified by the standard to be any particular kind of token.  Or
indeed whether it is one token per <digit> or one per <stop-code>.

The answer to these questions determines whether blanks are allowed,
disallowed, or optional, in the middle of a STOP statement in free
form.

Consider the following statements:
(1) STOP 123
(2) STOP123
(3) STOP 1 2 3

Which, if any, of these statements are standard-conforming?

ANSWER:

Fortran 2008 has revised the syntax of the STOP statement.
The <stop-code> is now a scalar integer constant expression or a
scalar default character constant expression.

Therefore only statement (1) is standard-conforming in free form.

EDITS to 10-007r1:

None.

SUBMITTED BY: Malcolm Cohen

HISTORY: 04-416    m170  F03/0021 submitted - Passed by J3 meeting
         05-146    m171  Failed J3 letter ballot #10
         11-212r1  m195  Revised answer - Passed by J3 meeting
         11-241    m196  Passed by J3 letter ballot #24 11-229
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

----------------------------------------------------------------------

NUMBER: F03/0046
TITLE: Unlimited polymorphic pointers in common blocks
KEYWORDS: Unlimited polymorphic pointer, common block
DEFECT TYPE: Clarification
STATUS: Passed by J3 letter ballot

QUESTION:

Does the following program conform to the Fortran 2008 standard?

      PROGRAM foo
        COMMON /blk1/ x
        CLASS(*), POINTER :: x
        CALL sub
      END PROGRAM

ANSWER:

No.

C5100 in Fortran 2008 prohibits unlimited polymorphic pointers in common.

EDITS to 10-007r1:

None.

SUBMITTED BY: Rob James

HISTORY: 05-137    m171  F03/0046 submitted - passed by J3 meeting
         05-170    m172  Passed J3 letter ballot #11
         N1622     m172  Failed WG5 ballot N1629
         11-216    m195  Revised answer for Fortran 2008 - Passed
                          by J3 meeting
         11-241    m196  Passed by J3 letter ballot #24 11-229
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

----------------------------------------------------------------------

NUMBER: F03/0053
TITLE: The BIND attribute for C_PTR and C_FUNPTR
KEYWORDS: BIND attribute, C_PTR, C_FUNPTR, private components
DEFECT TYPE: Erratum
STATUS: Passed by J3 letter ballot

QUESTION:

1. Do the derived types C_PTR and C_FUNPTR have the BIND attribute?

This affects whether an object of one of these types is permitted
directly in COMMON.  C5101 in the Fortran 2008 standard states "If a
common-block-object is of a derived type, it shall be a sequence type
or a type with the BIND attribute and it shall have no default
initialization."

2. Whether the derived types C_PTR and C_FUNPTR have the BIND
attribute affects whether they are extensible.  Subclause 4.5.7.1 of
the Fortran 2008 standard states "A nonsequence derived type that does
not have the BIND attribute is an extensible type."  Are these types
extensible?

3. Subclause 15.3.3 of the Fortran 2008 standard states that C_PTR and
C_FUNPTR are derived types with private components. Are user-defined
derived types with the BIND attribute permitted to have private
components?

ANSWER:

1. No, these types do not have the BIND(C) attribute.  15.3.3 does not
specify that they have the BIND(C) attribute.  15.3.4 does not require
them to have the BIND attribute in order to make them interoperable.
15.3.5 would require them to interoperate with a C struct if they had
the BIND(C) attribute; this is absurd, since C object pointers and C
function pointers are clearly not structs.

Note that whether these types have default initialization is not
specified by the standard, so possession of BIND(C) would not
necessarily have allowed them in COMMON anyway.

2. No, these types were not intended to be extensible.  It was an
oversight that these types were not explicitly excluded from being
extensible by subclause 4.5.7.1 paragraph 1 of the Fortran 2008
standard.  An edit is provided to correct this.

3. Yes, a user-defined derived type with the BIND attribute is
permitted to have private components.

EDITS to 10-007r1:

[10-007r1:19:15-16] In 1.3.147.6,
  replace the definition of "extensible type"
  with "type that may be extended using the EXTENDS clause (4.5.7.1)".

[10-007r1:4.5.7.1p1 77:3]

Insert ", other than the type C_PTR or C_FUNPTR from the intrinsic
module ISO_C_BINDING," after "A derived type".

SUBMITTED BY: John Reid

HISTORY: 05-151    m171  F03/0053 submitted - Passed by J3 meeting
         05-170    m172  Passed J3 letter ballot #11
         N1622     m172  Failed WG5 ballot N1629
         11-217r1  m195  Revised answer for Fortran 2008 - Passed
                          by J3 meeting
         11-241    m196  Passed as amended by J3 letter ballot
                          #24 11-229
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

----------------------------------------------------------------------

NUMBER: F03/0065
TITLE: Relational equivalence
KEYWORDS: Relational equivalence
DEFECT TYPE: Interpretation
STATUS: Passed by J3 letter ballot

QUESTION:

Given
  REAL X
  X = ... some value ...
may
  IF( X+3.0 .EQ. 3.0 )...
be transformed into
  IF( X .EQ. 0.0 )...
by the processor?

In Fortran 2003, 7.1.8.5 Evaluation of relational intrinsic operations
says
  "Two relational intrinsic operations are relationally equivalent if
   their logical values are equal for all possible values of their
   primaries."

On a machine where addition of 3.0 to a small value is not exact, the
logical values for X+3.0==3.0 are not the same as X==0.0 for all
possible values of X, therefore it would seem that this transformation
would not be possible.

However, Note 7.22 in Fortran 2003 shows this transformation as being
acceptable.

ANSWER:

No, the transformation is not permitted unless it gives the same
answer for all possible values (of X and X+3.0).

The erroneous example has been removed in Fortran 2008.

EDITS to 10-007r1:

None.

SUBMITTED BY: Fred Tydeman

HISTORY: 05-192    m173  F03/0065 submitted
         09-150    m187  Passed by J3 meeting
         09-187r2  m188  Failed J3 letter ballot #18 09-155
         11-222    m195  Revised answer - Passed by J3 meeting
         11-241    m196  Passed by J3 letter ballot #24 11-229
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

----------------------------------------------------------------------

NUMBER: F03/0084
TITLE: IEEE_SET_ROUNDING_MODE in a subroutine
KEYWORDS: IEEE_ARITHMETIC
DEFECT TYPE: Interpretation
STATUS: Passed by J3 letter ballot

QUESTION:

Section 7.1.7 of the Fortran 2008 standard says that if the value of an
expression can be determined before execution of the program, it is
standard-conforming to use the predetermined value.

Consider the subprogram

        SUBROUTINE S()
        USE, INTRINSIC :: IEEE_ARITHMETIC
        USE, INTRINSIC :: IEEE_FEATURES

        INTEGER, PARAMETER :: sp = IEEE_SELECTED_REAL_KIND(6,30)
        real(sp) :: X = 0.5559013_sp
        real(sp) :: Y = 1.2092481_sp
        real(sp) :: Z1, Z2
        IF (IEEE_SUPPORT_ROUNDING(IEEE_NEAREST,X) .AND. &
            IEEE_SUPPORT_ROUNDING(IEEE_UP,X)) THEN
            CALL IEEE_SET_ROUNDING_MODE(IEEE_UP)
            Z1 = X*Y
            CALL IEEE_SET_ROUNDING_MODE(IEEE_NEAREST)
            Z2 = X*Y
            PRINT *, 'Residual: ', Z1 - Z2
        ENDIF
        END

(1) Is a processor permitted always to print zero for the residual
    Z1 - Z2 ?
(2) Same question, after giving X and Y the PARAMETER attribute.

ANSWER:

(1) Yes.  The processor is allowed to evaluate expressions (constant
or otherwise) in any mathematically equivalent way.  In particular, it
is permitted to evaluate using higher precision than any precision
available when the program is executed.  For example, it might compute
Z1 == Z2 == 0.67222259081253, then compute Z1 - Z2 == 0.0, regardless
of how the program might do rounding at the seventh decimal digit when
it is executed.

(2) Yes, for the same reasons as question (1).

EDITS to 10-007r1:

None.

SUBMITTED BY: Michael Ingrassia

HISTORY: 06-372    m178  F03/0084 submitted
         11-218    m195  Revised answer for Fortran 2008 - Passed
                          by J3 meeting
         11-241    m196  Passed as amended by J3 letter ballot
                          #24 11-229
         12-165r2  m198  Passed as amended by J3 letter ballot
                          #25 12-147

----------------------------------------------------------------------

NUMBER: F03/0096
TITLE: Can a read statement change the unit value?
KEYWORDS: Read statement, unit value
DEFECT TYPE: Erratum
STATUS: Passed by J3 meeting

QUESTION:

Is it allowed to change the value of a variable which supplies the
unit number to a read statement?

10-007 [243:3-5] says the value of any input/output specifier shall not
depend on any input-item.  UNIT= is a specifier in a READ statement.

Note 9.40 on page 221 gives the example

         READ(N)  N, X(N)

and discusses how the changes to N work.

ANSWER:

Yes, the example was intended to be allowed as long as N is not an
internal unit.  Edits will limit the restriction to "output items"
in the specifier list and the Format.

EDITS to 10-007r1:

In 9.12, paragraph 5,
[243:3-4]
  Delete "on any <input-item>, <io-implied-do> <do-variable>, or",
  Making that sentence read:
    "The value of a specifier in an input/output statement shall not
     depend on the definition or evaluation of any other specifier in
     the <io-control-spec-list> or <inquire-spec-list> in that
     statement."
[243:5] Append new sentence to paragraph
  "The value of an <internal-file-variable> or of a FMT=, ID=, IOMSG=,
   IOSTAT= or SIZE= specifier shall not depend on the values of any
   <input-item> or <io-implied-do> <do-variable> in the same
   statement."

SUBMITTED BY: Dick Hendrickson

HISTORY: 07-266    m181  F03/0096 submitted
         07-266r1  m181  Draft answer - withdrawn, no reason, no vote
         10-246    m193  Draft answer for F2008
         10-246r1  m193  Revised edit - Passed by J3 meeting
         11-129    m194  Passed as amended by J3 letter ballot
                          #22 10-254
         11-006Ar1 m196  Adjust edits to reference 10-007r1
         N1878     m196  Failed WG5 ballot 1 N1876
         11-257    m196  Revised edit
         11-257r1  m196  Revised edit
         11-257r2  m196  Revised edit
	 12-135    m197  Revised edits - passed by J3 meeting
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

----------------------------------------------------------------------

NUMBER: F03/0103
TITLE: Restrictions on dummy arguments not present for polymorphic
       type or parameterized derived type
KEYWORDS: dummy argument, present, polymorphic, parameterized derived
          type
DEFECT TYPE: Erratum
STATUS: Passed by J3 letter ballot

QUESTION:

Consider
    Type t
      Real x
    End Type
    ...
    Subroutine s(x)
      Class(t),Optional :: x
      If (.Not.Present(x)) Call s2(x)
    End Subroutine
    Subroutine s2(y)
      Type(t),Optional :: y
      If (Present(y)) Print *,y
    End Subroutine

Q1. Is the reference to s2, passing a polymorphic optional argument
    that is not present to a non-polymorphic optional dummy, standard
    conforming?

Consider
    Type pdt(n)
      Integer,Len :: n
      Real x(n)
    End Type
    ...
    Subroutine s3(y)
      Type(pdt(*)),Optional :: y
      If (.Not.Present(y)) Call s4(y)
    End Subroutine
    Subroutine s4(z)
      Type(pdt(10)),Optional :: z
      If (Present(z)) Print *,z%x
    End Subroutine

Q2. Is the reference to s4, passing an optional dummy argument with an
    assumed type parameter to an optional dummy argument with a non-
    assumed type parameter, standard conforming?

    Note that 12.5.2.4 paragraph 3 requires the length type parameter
    values to be the same (with no mention of argument presence).

One might conjecture that these should not be conforming because the
argument passing conventions between s and s2, and between s3 and s4,
might be different (descriptor vs. reference).

DISCUSSION:

This does not seem to be limited to derived types, for example:
    Subroutine s3(y)
      Character(*),Optional :: y
      If (.Not.Present(y)) Call s4(y)
    End Subroutine
    Subroutine s4(z)
      Character(10),Optional :: z
      If (Present(z)) Print *,z
    End Subroutine
?

ANSWER:

These were all intended to be standard-conforming.

An edit is supplied to correct the type parameter matching
requirements.

EDITS to 10-007r1:

[293:6] 12.5.2.4, beginning of paragraph 3, insert new sentence
  "The kind type parameter values of the actual argument shall agree
   with the corresponding ones of the dummy argument."
and change
  "The type parameter values of the actual argument"
to
  "The length type parameter values of a present actual argument".

[293:10] 12.5.2.4, paragraph 4,
         before "scalar" insert "present".

SUBMITTED BY: Jim Xia

HISTORY: 07-298r1  m182  F03/0103 submitted
         07-298r2  m182  Passed by J3 meeting
         08-133r2  m183  Failed J3 letter ballot #15 08-101
         11-223    m195  Revised answer - Passed by J3 meeting
         11-241    m196  Passed as amended by J3 letter ballot
                          #24 11-229
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

----------------------------------------------------------------------

NUMBER: F03/0116
TITLE: indistinguishable specifics for a generic interface with
       use association
KEYWORDS: GENERIC RESOLUTION USE ASSOCIATION
DEFECT TYPE: Interpretation
STATUS: Passed by J3 letter ballot

Consider the following program

       MODULE M1
         INTERFACE SUBR
           MODULE PROCEDURE SUBR1
         END INTERFACE
       CONTAINS
         SUBROUTINE SUBR1
         END SUBROUTINE
       END

       MODULE M2
         INTERFACE SUBR
           MODULE PROCEDURE SUBR2
         END INTERFACE
       CONTAINS
         SUBROUTINE SUBR2
         END SUBROUTINE
       END

       PROGRAM MAIN
         USE M1
         CALL S
       CONTAINS
         SUBROUTINE S
           USE M2
           CALL SUBR
         END SUBROUTINE
       END

Is this program standard conforming?

ANSWER:

Subclause 12.4.3.4.5 of the Fortran 2008 standard forbids the
presence of such conflicting interfaces.

The rules in subclause 12.5.5.2 would be able to resolve the reference
to SUBR in the example, but this fact does not negate the prohibition
in subclause 12.4.3.4.5.

EDITS to 10-007r1:

None.

SUBMITTED BY: Robert Corbett and Michael Ingrassia

HISTORY: 08-169    m184  F03/0116 submitted
         11-219r1  m195  Revised answer - Passed by J3 meeting
         11-241    m196  Passed by J3 letter ballot #24 11-229
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

----------------------------------------------------------------------

NUMBER: F03/0118
TITLE: Are lower bounds of assumed-shape arrays assumed?
KEYWORDS: LBOUND, assumed-shape array, constant expression
DEFECT TYPE: Erratum
STATUS: Passed by J3 letter ballot

QUESTION:

Does the following program conform to the 2008 Fortran standard?

  subroutine S ( A )
    integer :: A(:,3:)
    integer, parameter :: R = size(lbound(A))
  end subroutine S

Processors disagree.  If the lower bounds of an assumed-shape array
are assumed, LBOUND(A) is not a constant expression according
to item (4)(b)(i) in subclause 7.1.12.  If the lower bounds of an
assumed-shape array are not assumed, LBOUND(A) is a constant
expression in this case, but might be a specification expression in
other cases.

ANSWER:

This program conforms to the 2008 Fortran standard.  The lower bounds
of an assumed-shape array are not assumed.  If a lower bound is not
specified, it has the value 1 -- see the final sentence of the final
paragraph of subclause 5.3.8.3.  If a lower bound is specified, it
must be specified either by a constant expression or a specification
expression.  In the example in the question, the lower bound of the
first dimension is omitted, and therefore has the value 1, while the
lower bound of the second dimension is given by a constant
expression. Therefore, the reference to LBOUND is a constant
expression, and thus the reference to SIZE is a constant expression.

EDITS to 10-007r1:

None.

SUBMITTED BY: Van Snyder

HISTORY: 08-200r1  m185  F03/0118 submitted
         11-215    m195  Revised for F08 - Passed by J3 meeting
         11-241    m196  Passed as amended by J3 letter ballot
                          #24 11-229
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

---------------------------------------------------------------------

NUMBER: F03/0120
TITLE: When are parameterized sequence types the same type?
KEYWORDS: type parameter, sequence type
DEFECT TYPE: Erratum
STATUS: Passed by J3 meeting

QUESTION:

(1) What does 4.5.2.4 mean by the phrase "have type parameters and
components that agree in order, name, and attributes?"
Does

      REAL A(2*N)

"agree" with

      REAL A(N+N) ?

Does

      REAL A(N*N)

"agree" with

      REAL A(N**2) ?

(2) How complicated can the expressions a processor must
determine are equal or different be?

DISCUSSION:

The Fortran 2008 standard allows sequence types to have type
parameters (4.5.2, 4.5.2.3).  The Fortran 2008 standard also
gives rules for deciding when two entities declared with
reference to derived-type definitions have the same
type (4.5.2.4).  Those rules break down for parameterized
sequence types.

Although the Fortran 2008 standard does not explicitly say
it, the standard assumes that two attributes that include
one or more expressions agree only if the values of those
expressions are the same.  Previous standards used
attributes with expressions that could not be evaluated
statically only in contexts where the processor was not
required to determine if those attributes agreed.  The
inclusion of parameterized sequence types has created
situations where it is necessary for the processor to
determine if such attributes agree.

QUESTION:

(3) Consider the modules

       MODULE M1
         TYPE T(N)
           INTEGER(KIND=4), KIND :: N
           SEQUENCE
           REAL A(2*N)
         END TYPE
         TYPE(T(4)) :: X
       END

       MODULE M2
         TYPE T(N)
           INTEGER(KIND=4), KIND :: N
           SEQUENCE
           REAL A(N+N)
         END TYPE
         TYPE(T(4)) :: Y
       END

Are the variables X and Y in this example of the same
type?

(4) What if the two instances of the type parameter N
in the previous example were not kind type parameters?

(5) Consider the modules

       MODULE M1
         INTERFACE S
           SUBROUTINE S1(X, M)
             TYPE T(N)
               INTEGER, LEN :: N
               SEQUENCE
               REAL A(N+N)
             END TYPE
             TYPE(T(M)) :: X
           END SUBROUTINE
         END INTERFACE
         TYPE T(N)
           INTEGER, LEN :: N
           SEQUENCE
           REAL A(N+N)
         END TYPE
         TYPE(T(2)) :: X
       END

       MODULE M2
         INTERFACE S
           SUBROUTINE S2(X, M)
             TYPE T(N)
               INTEGER, LEN :: N
               SEQUENCE
               REAL A(2*N)
             END TYPE
             TYPE(T(M)) :: X
           END SUBROUTINE
         END INTERFACE
         TYPE T(N)
           INTEGER, LEN :: N
           SEQUENCE
           REAL A(2*N)
         END TYPE
         TYPE(T(2)) :: X
       END

If these two modules are used in the same scoping unit
and there is a CALL of the generic subroutine S in that
scoping unit, does the Fortran 2008 standard
require a conforming processor to detect and report
the conflict with the rules given in 12.4.3.4.5?  It seems
it might or might not  depending
on one's interpretation of item (6) in 1.5.

DISCUSSION:

Some have suggested that two attributes that include
expressions should be said to agree if and only if the
corresponding expressions are equivalent.  One problem
with that notion is that in general the question of
whether two expressions are equivalent is undecidable.
That problem could be circumvented by restricting the
forms of expressions allowed.  For example, the
expressions might be restricted to be polynomials of
one or more variables.  In that case, the problem of
determining equivalence is merely intractable, not
impossible.

Some have suggested that the notion of requiring only
that the values agree should be maintained.  One
consequence of that would be that some constraint
violations that are can currently be detected
statically could only be detected dynamically.
For example, consider the program

      MODULE M1
        TYPE T(N)
          INTEGER(KIND=4), LEN :: N
          SEQUENCE
          REAL A(N+N)
        END TYPE
      END

      MODULE M2
        TYPE T(N)
          INTEGER(KIND=4), LEN :: N
          SEQUENCE
          REAL A(N*N)
        END TYPE
      END

      SUBROUTINE S(N)
        USE M1, T1=>T
        USE M2, T2=>T
        TYPE(T1(N)) :: X
        TYPE(T2(N)) :: Y
        Y%A = 0.0
        X = Y
      END

      PROGRAM MAIN
        READ *, N
        CALL S(N)
      END

Under the interpretation requiring equal values, the
question of whether the processor must detect and
report a constraint violation in the assignment X = Y
cannot be determined until the value of N is known.

Another suggestion was that attributes that include
expressions agree if and only if they are textually
equivalent.  That opens up the question of what it
means to say that two expressions are textually
equivalent.  Does whitespace count?  Is "2"
textually equivalent to "02"?  It "2" textually
equivalent to a named constant "TWO" whose value is
two?

Another suggestion was that two entities declared
with reference to derived-type definitions in different
scoping units should be considered to be of different
if either or both of the derived-type definitions
include type parameters.  At least that solution is
easy to specify.

Parameterized sequence types add so little value to the
Fortran language that they cannot be worth the trouble
they cause for the language specification, for
implementors, and, if there are any users, for users.
Therefore, I suggest banning parameterized sequence
types from the language.  Implementations that
currently support parameterized sequence types can
continue to support them due to the permissive nature
of the Fortran standard.

ANSWER:

It was not intended that parameterized derived
types participate in the algorithm for determining when
two types are the same, as given in section 4.5.2.4.
Therefore the answers to the questions are:
Not Applicable, Not Applicable, No, Still No, and No.

To make this effective, edits are supplied which ban
parameterized sequence types from the language.

EDITS to 10-007r1:

[24:11+] Append new paragraph to 1.6.2 Fortran 2003 compatibility

  "Fortran 2003 permitted a sequence type to have type parameters;
   that is not permitted by this part of ISO/IEC 1539."

[62:19] 4.5.2.3 Sequence type, Replace constraint C436 with

  "C436 (R425) If SEQUENCE appears, each data component shall be
        declared to be of an intrinsic type or of a sequence type, the
        derived type shall not have type parameters, and a
        <type-bound-procedure-part> shall not appear."

[63:9] 4.5.2.4 Determination of derived types, paragraph 2,
       delete the phrase "type parameters and".

SUBMITTED BY: Robert Corbett

HISTORY: 08-261    m185  F03/0120 submitted
         11-224    m195  Revised answer - Passed by J3 meeting
         11-241    m196  Failed J3 letter ballot #24 11-229
         11-255    m196  Revised answer
         11-255r1  m196  Passed by J3 meeting
	 12-132	   m197  Revised edits - passed by J3 meeting
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

----------------------------------------------------------------------

NUMBER: F03/0121
TITLE: Precise FP semantics of the REAL intrinsic
KEYWORDS: REAL intrinsic
DEFECT TYPE: Clarification
STATUS: Passed by J3 meeting

QUESTION:

Must the intrinsic function REAL with KIND parameter wp return a value
that is a REAL (KIND=wp) floating point number?

RATIONALE FOR THE QUESTION:

Computer hardware may use a wider floating-point format for registers
than for memory; e.g., 80 bits for registers and 64 bits for memory
for the case of standard double precision floating point numbers.
Some algorithms require a high level of control over floating point
semantics.  If the intrinsic function REAL with KIND parameter wp is
guaranteed to return a REAL (KIND=wp) result then a programmer can use
this to force intermediate results into main memory format, never mind
that the optimizing compiler may have placed the intermediate in a
register.

I am interested in a J3 interpretation of this matter, especially a
loud and clear affirmative interpretation, because it appears that
some present Fortran compilers optimize away my explicit use of the
REAL intrinsic.  The context is code for compensated summation (Kahan
summation).  I appreciate that parentheses are inviolable courtesy of
the Fortran standard, but in order to have code that cannot be broken
by an optimizing compiler I seem to need also a language mechanism to
force intermediate results into main memory format.

Bas Braams
Chemistry Department and
Emerson Center for Scientific Computation
Emory University
Atlanta, GA

ANSWER:

Yes, for purposes of determining the type and kind of the result, for
use in subclause 7.1.9.3, the result of the intrinsic function REAL with
KIND argument wp returns a value that is of type REAL(KIND=wp).
However, if it is used within an expression involving intrinsic
operations,
  "the processor may evaluate any mathematically equivalent
   expression, provided that the integrity of parentheses is not
   violated."
and
  "mathematically equivalent expressions of numeric type may produce
   different computational results",
which means that it is unlikely to serve your purpose.

Intermediate results can be rounded to storage format by assignment to a
VOLATILE variable.

EDITS to 10-007r1:

None.

HISTORY: 08-208r1  m185  F03/0121 submitted
         10-240    m193  Draft answer for F2008 - Passed by J3 meeting
         11-129    m194  Passed by J3 letter ballot #22 10-254
         N1878     m186  Failed WG5 ballot 1 N1876
         11-260    m196  Revised answer
         11-260r1  m196  Passed by J3 meeting
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

----------------------------------------------------------------------

NUMBER: F08/0004
TITLE: Is TARGET argument of ASSOCIATED a pointer or nonpointer dummy?
KEYWORDS: TARGET argument of ASSOCIATED
DEFECT TYPE: Erratum
STATUS: Passed by J3 meeting

QUESTION:

Is the following conforming, and if so what does it print?

  program TARGET_Arg
    integer, pointer :: Pointer
    integer, pointer :: Target => NULL()
    integer, target :: AnotherTarget
    pointer => anotherTarget
    print *, Associated(pointer,target)
  end program TARGET_Arg

DISCUSSION:

Subclause 13.7 stipulates that descriptions of arguments of intrinsic
procedures apply to actual arguments.  This leaves open the question
whether the TARGET dummy argument of ASSOCIATED is a pointer or not.

If not a pointer, being optional, it is considered by subclause
12.5.2.12 to be absent if the corresponding actual argument is
disassociated.

Thereby, the result value of ASSOCIATED (by Case(i) of the result
value clause) is true.

If the TARGET dummy argument is a pointer, the result value of
ASSOCIATED (by Case (iv) of the result value clause) is false.

ANSWER:

The Result Value paragraph of 13.7.16 ASSOCIATED only makes sense if
the references to TARGET are talking about the actual argument.
Therefore the program is standard conforming and prints F.

An edit is supplied to remind the reader.

NOTE: This subsumes interp F08/0005 (10-152).

EDITS to 10-007r1:

[330:36+] Insert new Note

  "NOTE 13.8a
   The references to TARGET in the above cases are referring to
   properties that might be possessed by the actual argument, so the
   case of TARGET being a disassociated pointer will be covered by
   case (iii), (vi), or (vii).".

SUBMITTED BY: Van Snyder

HISTORY: 10-149    m192  F08/0004 submitted
         10-149r1  m192  revised - Passed by J3 meeting
         10-202    m192  Passed by J3 letter ballot #21 10-199
         11-006Ar1 m196  Adjust edits to reference 10-007r1
         N1878     m197  Failed WG5 ballot 1 N1876
         12-138    m197  Revised edits - passed by J3 meeting
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

------------------------------------------------------------------------

NUMBER: F08/0008
TITLE: IEEE exceptions for intrinsic functions
KEYWORDS: IEEE_INVALID, SQRT
DEFECT TYPE: Interpretation
STATUS: Passed by J3 meeting

QUESTIONS:

Section 13.7.1, page 325, lines 10-12 states

    If an infinite result is returned, the flag IEEE_OVERFLOW
    or IEEE_DIVIDE_BY_ZERO shall signal; if a NaN result is
    returned, the flag IEEE_INVALID shall signal.

Question (1):
The Fortran 2008 standard does not require a standard-conforming
processor to support IEEE_INVALID [14.3p8, 404:15].  If a
processor does not support IEEE_INVALID, is it required to signal
IEEE_INVALID when a NaN result is returned?

Question (2):
IEC 60559 requires the result of SQRT(+inf) to be +inf without
overflow being signaled.  IEC 60559 requires SQRT(qNaN), where qNaN
is a quiet NaN, not to signal an invalid operand exception.  Does
Fortran 2008 require SQRT(QNaN) to signal IEEE_INVALID?

ANSWERS:

A1. No, if the processor does not support IEEE_INVALID, it cannot
    signal IEEE_INVALID.  An edit is provided to clarify this.

A2. No, the standard does not specify the behavior of SQRT on qNaN.

EDITS to 10-007r1:

[325:7] Change "is prohibited from invoking" to "shall not invoke".
{Simpler wording is easier to understand.}

[325:7-8] "returned in" -> "assigned to".
{Correct wording instead of nonsense.}

[325:8] After "or" insert "returned as a".
{Continue correcting grammar.}

[325:8-12] Replace "outside ... invoked" with
  "not representable by objects of the specified type and type
   parameters".

[325:12+] Insert new paragraph
  "If an IEEE infinity is assigned or returned by an intrinsic
   procedure, the intrinsic module IEEE_ARITHMETIC is accessible, and
   the actual arguments were finite numbers, the flag IEEE_OVERFLOW or
   IEEE_DIVIDE_BY_ZERO shall signal.   If an IEEE NaN is assigned or
   returned, the actual arguments were finite numbers, the intrinsic
   module IEEE_ARITHMETIC is accessible, and the exception
   IEEE_INVALID is supported, the flag IEEE_INVALID shall signal.  If
   no IEEE infinity or NaN is assigned or returned, these flags shall
   have the same status as when the intrinsic procedure was invoked."

SUBMITTED BY: Robert Corbett

HISTORY: 10-155    m192  F08/0008 submitted
         10-155r1  m192  Fix title
         10-155r2  m192  Draft answer
         10-155r3  m192  Revised answer - Passed by J3 meeting
         10-202    m192  Passed by J3 letter ballot #21 10-199
         N1878     m197  Failed WG5 ballot 1 N1876
         12-144    m197  Attempt to fix 13.7.1
         12-144r1  m197  Passed by J3 meeting
         12-165r2  m198  Passed as amended by J3 letter ballot
                          #25 12-147

------------------------------------------------------------------------

NUMBER: F08/0031
TITLE: PURE INTENT(OUT) finalization
KEYWORDS: PURE INTENT(OUT) FINAL
DEFECT TYPE: Erratum
STATUS: Passed by J3 meeting
QUESTION:

Consider
  MODULE m
    TYPE t
      ...
    CONTAINS
      FINAL f
    END TYPE
    INTEGER :: fcount = 0
  CONTAINS
    SUBROUTINE f(x)
      TYPE(t),INTENT(INOUT) :: x
      ...
      fcount = fcount + 1
    END SUBROUTINE
    PURE SUBROUTINE zap(x)                ! (1)
      TYPE(t),INTENT(OUT) :: x
    END SUBROUTINE
    PURE SUBROUTINE bad(y)
      TYPE(t),INTENT(INOUT) :: y
      CALL zap(y)                         ! (2)
    END SUBROUTINE
  END MODULE

Clearly, even though subroutine zap is pure, invoking it causes impure
final subroutine f to be called and so therefore it cannot be invoked
in any context that requires it to be pure.

Thus the call marked (2) is invalid.

The question is whether the subroutine definition itself (marked (1))
is standard-conforming.  If finalization of INTENT(OUT) arguments is
considered to be done by the called procedure, then the subroutine
definition is not standard-conforming.  If finalization of INTENT(OUT)
arguments is done by the caller, the subroutine definition might be
standard-conforming.

It would certainly seem a bit strange to be able to define a PURE
procedure that cannot be invoked anywhere purity is required.

DISCUSSION:

Although the phrase "When a procedure is invoked" sounds like
finalization occurs in the caller of a procedure and not in the called
procedure, being PURE or having a finalizable INTENT(OUT) dummy
argument are not grounds for an explicit interface to be required.

This would appear to require, as a matter of practicality, that the
processor performs the finalization of the actual argument on entry to
the called procedure.  I.e., that the impure final subroutine will in
actuality be called from the pure procedure.

ANSWER:

Allowing a PURE procedure to cause invocation of impure final
procedures in this way was inadvertant.  An edit is supplied to
clarify that any INTENT(OUT) dummy arguments of a PURE procedure must
not have a relevant impure FINAL procedure.

EDITS to 10-007r1:

[312:21+] In 12.7 after C1277, insert new constraint
  "C1277a An INTENT(OUT) argument of a pure procedure shall not be
          such that finalization of the actual argument would
          reference an impure procedure."
{In some other constraints we use "procedure that is not pure", but
 "impure procedure" is a simpler way of saying the same thing.}

SUBMITTED BY: Malcolm Cohen

HISTORY: 10-181    m192  F08/0031 submitted
         10-181r1  m192  Revised - Passed by J3 meeting
         10-202    m192  Passed by J3 letter ballot #21 10-199
         11-006Ar1 m196  Adjust edits to reference 10-007r1
         N1889     m197  Failed WG5 ballot 2 N1877
         12-142    m197  Removed J3 note, no other changes -
                          passed by J3 meeting
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

------------------------------------------------------------------------

NUMBER: F08/0032
TITLE: PURE FUNCTION result finalization
KEYWORDS: PURE FUNCTION FINAL
DEFECT TYPE: Erratum
STATUS: Passed by J3 meeting

QUESTION:

Consider
  MODULE m
    TYPE t
      REAL c
    CONTAINS
      FINAL f
    END TYPE
    INTEGER :: fcount = 0
  CONTAINS
    SUBROUTINE f(x)
      TYPE(t),INTENT(INOUT) :: x
      x%c = 0
      fcount = fcount + 1
    END SUBROUTINE
    PURE TYPE(t) FUNCTION g(a)
      REAL,INTENT(IN) :: a
      g%c = a
    END FUNCTION
  END MODULE

Even though this function is PURE, invoking it will inevitably result
in the execution of the impure FINAL subroutine f.  Thus, it cannot be
used within another PURE procedure or from within a DO CONCURRENT
loop, though it can be used from within a FORALL (because the
finalizations only get done on termination of the outermost FORALL).

Some other cases of impure finalization are prohibited by C1284, but
not this because it does not occur "in" the procedure.

Should an impurely-finalizable function result be allowed for a pure
function?

ANSWER:

No, this should not be allowed.  An edit is supplied to correct this
oversight in the requirements for pure procedures.

EDITS to 10-007r1 (as modified by corrigendum 1):

[24:11+] 1.6.2 at end of subclause insert new paragraph:

  "Fortran 2003 permitted the result variable of a pure function to be
   a polymorphic allocatable variable, or to be finalizable by an
   impure final subroutine.  These are not permitted by this part of
   ISO/IEC 1539."

[312:19+] In 12.7 after C1276, insert new constraints

  "C1276a The result variable of a pure function shall not be such
          that finalization of a reference to the function would
          reference an impure procedure.

   C1276b A pure function shall not have a polymorphic allocatable
	  result variable."

SUBMITTED BY: Malcolm Cohen

HISTORY: 10-182    m192  F08/0032 Submitted
         10-182r1  m192  Revised - Passed by J3 meeting
         10-202    m192  Passed as amended by J3 letter ballot
                          #21 10-199
         11-006Ar1 m196  Adjust edits to reference 10-007r1
         N1889     m197  Failed WG5 ballot 2 N1877
	 12-134    m197  Revised edits - passed byJ3 meeting
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

------------------------------------------------------------------------

NUMBER: F08/0038
TITLE: Are pointless restrictions on DIM arguments intended?
KEYWORDS: DIM argument, optional, intrinsic reduction function
DEFECT TYPE: Clarification
STATUS: Passed by J3 meeting

DISCUSSION:

Some of the reduction functions have two forms, one with a DIM
argument and one without; the DIM argument is not optional.  IALL is
an example.  Other reduction functions have a DIM argument that is
optional.  COUNT is an example.  The actual argument corresponding to
the DIM actual argument is prohibited from being an optional dummy
argument in both cases.  The reason in the case of an optional DIM
argument is so that the processor can determine the rank of the
result.  In the case of those with two forms, there is no problem for
the processor to determine the rank, so the prohibition against the
corresponding actual argument being an optional dummy argument is
pointless.  There is already a prohibition against it being an absent
optional dummy argument in 12.5.2.12p3(4) [299].

Consider, for example

  subroutine S ( ARRAY, DIM )
    integer, intent(in) :: ARRAY(:,:)
    integer, intent(in), optional :: DIM
    if ( present(dim) ) then
      print *, iall(array,dim)
    else
      print *, iall(array)
    end if
  end subroutine S

This subroutine clearly does not conform, but a processor would have
no difficulty determining the rank of the result of IALL(ARRAY,DIM).

QUESTION:

(1) Was the pointless restriction intentional, or was it an oversight
that it did not get removed in the two-form case when MAXLOC etc. were
added?

(2) Is it necessary to continue the pointless restriction?

ANSWER:

(1) Yes, this was intentional.  These could have been removed in
    Fortran 95, Fortran 2003, or Fortran 2008, but there was no
    request for removal.

(2) No, but it is inappropriate to provide a new feature that would
    need many edits via the defect processing system.  If this feature
    is desired it can be added in a future revision of the language.

EDITS to 10-007r1:

None.

SUBMITTED BY: Van Snyder

HISTORY: 10-187r1  m192  F08/0038 submitted
         10-187r2  m192  Revised edit - Passed by J3 meeting
         10-202    m192  Passed by J3 letter ballot #21 10-199
         11-006Ar1 m196  Adjust edits to reference 10-007r1
         N1889     m197  Failed WG5 ballot 2 N1877
	 12-133	   m197  Revised answer - passed by J3 meeting
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

------------------------------------------------------------------------

NUMBER: F08/0042
TITLE: SOURCE= questions
KEYWORDS: ALLOCATE, SOURCE=
DEFECT TYPE: Erratum
STATUS: Passed by J3 meeting

QUESTION:

Consider the program
  PROGRAM example1
  REAL,ALLOCATABLE :: x(:),y(:)
  ALLOCATE(x(10),y(10),SOURCE=3.14159265)
  PRINT *,x,y
  END

This program does not conform to Fortran 2003 due to constraint C631
which stated
  "If SOURCE= appears, ... <allocation-list> shall contain only one
   <allocate-object> ...".

The corresponding constraint in Fortran 2008, C638 [127], is missing
this requirement, so apparently the program is now syntactically
correct.

However, the Introduction to the Fortran 2008 standard does not
mention this as a new feature.

Furthermore, 6.7.1.1 paragraph 4 [127] begins
  "If <allocate-object> is a coarray, <source-expr> shall not have a
   dynamic type of ..."
which implies that there is only one <allocate-object> for a
<source-expr> (at least when the <allocate-object> is a coarray).

Similarly, the wording of constraint C639 implies a one-to-one
correspondence between <allocate-object> and <source-expr>.

Q1. Is the omission of the single allocation requirement of Fortran
    2003 an oversight? (i.e. is example1 non-conforming?).

Also, consider the program
  PROGRAM example2
  REAL,ALLOCATABLE :: x[:]
  ALLOCATE(x[*])
  x = 3
  END

The ALLOCATE statement appears not to conform to Fortran 2008 because
of 6.7.1.1 paragraph 4; since <source-expr> does not appear, it cannot
satisfy any condition about its dynamic type.

Q2. Is an ALLOCATE statement for a coarray required to have SOURCE=?
    (i.e. is example2 non-conforming?).

Also, if multiple allocations with SOURCE= are permitted,
consider the program
  PROGRAM example3
    INTEGER,ALLOCATABLE :: x,y
    ALLOCATE(x,y,SOURCE=f())
    PRINT *,x,y
  CONTAINS
    INTEGER FUNCTION f()
      INTEGER,SAVE :: n = 1
      f = n
      n = n + 1
    END FUNCTION
  END PROGRAM

The execution semantics of SOURCE= in 6.7.1.2 paragraph 7 do not state
whether the <source-expr> is evaluated once per statement or once per
allocation.  If the processor evaluates per statement execution,
something like " 1 1" will be printed, but if it evaluates it per
allocation, something like " 1 2" could be printed.

Q3. How many times may <source-expr> be evaluated in an ALLOCATE
    statement with multiple allocations?

Also, consider the program
  PROGRAM example4
    REAL,ALLOCATABLE :: x(:)
    ALLOCATE(x,SOURCE=[0.5,1.5])
    PRINT *,x
  END PROGRAM

The Introduction implies that this program should be standard-
conforming, but it violates constraint C633, which begins
  "(R631) If <allocate-object> is an array either <allocate-shape-
   spec-list> shall appear or <source-expr> shall appear ..."
The requirements of C633 are not satisfied because R631 is
<allocation> and <source-expr> does not appear in R631.

Q4. Is example4 intended to be standard-conforming?

ANSWER:

The answer to question 1 is No.
This feature was deliberately added to the Fortran 2008 standard.
Edits are supplied to correct its exposition.

The answer to question 2 is No.
An edit is supplied to correct paragraph 4 of 6.7.1.1.

The answer to question 3 is once.
An edit is supplied to clarify paragraph 7 of 6.7.1.2.

The answer to question 4 is Yes.
An edit is supplied to correct constraint C633.

EDITS to 10-007r1:

[xv] Introduction, bullet "Data usage and computation",
  Before "MOLD="
  Insert "Multiple allocations are permitted in a single ALLOCATE
          statement with SOURCE=."
{(Q1) Add new feature to the feature list.}

[126:31-33] Replace C633 entirely with the constraints
  "C633 (R626) If an <allocate-object> is an array, either <allocate-
        shape-spec-list> shall appear in its <allocation>, or <source-
        expr> shall appear in the ALLOCATE statement and have the same
        rank as the <allocate-object>.

   C633a (R631) If <allocate-object> is scalar, <allocate-shape-spec-
         list> shall not appear."
{(Q4) Fix broken constraint.}

[127:5] Constraint C639, replace entirely with
  "C639 (R626) If <source-expr> appears, the kind type parameters of
        each <allocate-object> shall have the same values as the
        corresponding type parameters of <source-expr>."
{(Q1) Fix singular implication.  Avoid introducing any implication
 that each <allocate-object> has the same set of kind type parameters
 or that any <allocate-object> has the same set of kind type
  parameters as the <source-expr> - the relationship is a subset.}

[127:18-19] 6.7.1.1 paragraph 4, replace entirely with
  "If an <allocate-object> is a coarray, the ALLOCATE statement shall
   not have a <source-expr> with a dynamic type of C_PTR, C_FUNPTR, or
   LOCK_TYPE, or which has a subcomponent whose dynamic type is
   LOCK_TYPE."
{(Q2) Fix implied requirement of SOURCE= appearance for coarrays.}

[128:26] 6.7.1.2 paragraph 7, append new sentence
  "The <source-expr> is evaluated exactly once for each execution of
   an ALLOCATE statement."
{(Q3) Clarify number of evaluations.}

SUBMITTED BY: Malcolm Cohen

HISTORY: 10-211    m193  F08/0042 submitted - Passed by J3 meeting
         11-129    m194  Passed by J3 letter ballot #22 10-254
         11-006Ar1 m196  Adjust edits to reference 10-007r1
         N1889     m197  Failed WG5 ballot 2 N1877
         12-140    m197  Revised Q2 and edits - passed by J3 meeting
         12-165r2  m198  Passed as amended by J3 letter ballot
                          #25 12-147

----------------------------------------------------------------------

NUMBER: F08/0043
TITLE:  Executing a type-bound procedure on a coindexed object
KEYWORDS: coarrays, polymorphism
DEFECT TYPE: Clarification
STATUS: Passed by J3 meeting

QUESTION:

Consider the following program:

  module m
    type :: foo
      integer :: i = 0
    contains
      procedure, pass :: op
    end type
  contains
    subroutine op(this, i)
      class(foo) :: this
      this%i = i
    end subroutine
  end module m
  program p
    use m
    class(foo), allocatable :: o_foo[:]
    integer :: me
    allocate(foo :: o_foo[*])

    me = this_image()
    if (me == 1) then
      call o_foo[2]%op(1)             ! Type-bound call.
    end if
    sync all
    if (me == 2) write(*,*) o_foo%i
  end program p

This program is not standard-conforming, as it violates one of the
requirements of 12.5.2.4p2 [293], viz
  "If the actual argument is a polymorphic coindexed object,
   the dummy argument shall not be polymorphic."

However, if the type-bound call were replaced by

  SELECT TYPE(o_foo)
  TYPE IS (foo)
    CALL o_foo[2]%op(1)
  END SELECT

appears to be standard-conforming.

The example program appears to be harmless, so the requirement appears
to be unnecessary.  It is conjectured that the requirement is
misworded and should instead be
  "If the actual argument is a polymorphic subobject of a coindexed
   object, the dummy argument shall not be polymorphic."?

Q1. Is this requirement intentional?

Furthermore, constraint C1229 says of a <data-ref> that is the object
for a type-bound procedure reference, that it
  "shall not be a polymorphic subobject of a coindexed object";
however, C617 already prohibits any <data-ref> from being a
polymorphic subobject of a coindexed object except as the subject of
a type parameter inquiry or as the actual argument in an intrinsic
inquiry function reference, so C1229 appears to be completely
redundant.

Q2. Is constraint C1229 redundant?

ANSWER:

A1. The requirement is intentional.

A2. Yes, constraint C1229 is redundant.
    It will be removed in a future revision.

EDITS to 10-007:

None.

SUBMITTED BY: R. Bader

HISTORY: 10-208    m193  F08/0043 submitted
         10-208r1  m193  Revised - Passed by J3 meeting
         11-129    m194  Passed by J3 letter ballot #22 10-254
         11-006Ar1 m196  Adjust edits to reference 10-007r1
         N1889     m197  Failed Wg5 ballot 2 N1877
         12-143    m197  Removed attempt to explain the rationale -
                          passed by J3 meeting
         12-165r2  m198  Passed as amended by J3 letter ballot
                          #25 12-147

----------------------------------------------------------------------

NUMBER: F08/0048
TITLE:  Sequence association for coarrays
KEYWORDS: sequence association, coarrays
DEFECT TYPE: Erratum
STATUS: Passed by J3 meeting

QUESTION:

Was the text in 12.5.2.8:
"If the dummy argument is an array coarray that has the CONTIGUOUS
attribute or is not of assumed shape, the corresponding actual argument
shall be simply contiguous."
intended to disallow sequence association for coarrays, as
illustrated by the example

   interface
      subroutine sub (x)
         real x(10)[*]
      end subroutine
   end interface
   ...
   real :: x(100)[*]
   ...
   call sub (x(10))

ANSWER:

No. This restriction contradicts 12.5.2.4 paragraph 13, which allows
the example program. An edit is supplied to correct this.

EDIT:

In 12.5.2.8 Coarray dummy variables, at the end of paragraph 2 [297:5],
add "or an element of a simply contiguous array".

SUBMITTED BY: John Reid

HISTORY: 10-226    m193  F08/0048 submitted
         10-226r1  m193  Revised answer
         10-226r2  m193  Passed by J3 meeting
         11-129    m194  Failed J3 letter ballot #22 10-254
         12-124    m197  Changed answer - passed by J3 meeting
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

----------------------------------------------------------------------

NUMBER: F08/0054
TITLE: Requirements for needing an explicit interface
KEYWORDS: Explicit interface
DEFECT TYPE: Erratum
STATUS: Passed by J3 meeting

QUESTION:

Consider the program

  SUBROUTINE Fred() BIND(C,NAME='Nurke')
    PRINT *,'ok'
  END SUBROUTINE
  SUBROUTINE S(dummy)
    INTERFACE
      SUBROUTINE dummy() BIND(C)
      END SUBROUTINE
    END INTERFACE
    CALL dummy
  END SUBROUTINE
  PROGRAM example1
    EXTERNAL Fred,S
    CALL S(Fred)
  END PROGRAM

According to 12.4.2.2, an explicit interface is only ever required in
a scope where a procedure is referenced.  The main program does not
reference Fred, so this appears to be conforming.  It appears that
no processors accept this example...

However, the very similar program minus the BIND(C) specifications

  SUBROUTINE Freddy(x)
    LOGICAL,OPTIONAL :: x
    IF (PRESENT(x)) PRINT *,'ok'
  END SUBROUTINE
  SUBROUTINE SUB(dummy)
    INTERFACE
      SUBROUTINE dummy(x)
        LOGICAL,OPTIONAL :: x
      END SUBROUTINE
    END INTERFACE
    CALL dummy(.TRUE.)
  END SUBROUTINE
  PROGRAM example2
    EXTERNAL Freddy,SUB
    CALL SUB(Freddy)
  END PROGRAM

but with a different reason for requiring an explicit interface, is
also apparently valid in Fortran 2003/2008 but is not valid in
Fortran 90 or Fortran 95, because they require the explicit interface
without the condition of the procedure being referenced in that
scope.

This feature (viz only require the explicit interface where it is
referenced) was added by paper 02-144, which makes no mention of it
being a new feature.

Was this a deliberate new feature?

ANSWER:

No, this was a mistake in 02-144 and thus in Fortran 2003 and 2008.
An edit is provided to correct the mistake.

EDITS to 10-007r1 (after corrigendum 1):

[24:11+] 1.6.2 Compatibility, at the end, insert new paragraph

   "Fortran 2003 only required an explicit interface for a procedure
    that was actually referenced in the scope, not merely passed as an
    actual argument.  This part of ISO/IEC 1539 requires an explicit
    interface for a procedure under the conditions listed in 12.4.2.2,
    regardless of whether the procedure is referenced in the scope."

[279:19] In 12.4.2.2p1, replace
   "A procedure ... and"
with
   "Within the scope of a procedure identifier, the procedure shall
    have an explicit interface if \obs{it is not a statement function
    and}"

SUBMITTED BY: Malcolm Cohen

HISTORY: 11-135    m194  F08/0054 submitted
         11-135r1  m194  Passed by J3 meeting
         11-207r1  m195  Passed as amended by J3 letter ballot #23
                          11-156
         N1889     m197  Failed WG5 ballot 2 N1877
         12-141    m197  Revised edits
         12-141r1  m197  Revised edits - Passed by J3 meeting
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

----------------------------------------------------------------------

NUMBER: F08/0055
TITLE: G editing for reals
KEYWORDS: format, G editing
DEFECT TYPE: Erratum
STATUS: Passed by J3 letter ballot

QUESTION:

Q1. Gw.d editing for a real value that is in the range (0.1,10**d) and
    is not near an integer power of 10 uses F editing to produce
    exactly a value with d significant digits.  For values in this
    range that are near an integer power of 10, is it intended that F
    editing be used to produce a value with d significant digits?

The rules in 10.7.5.2.2 usually have this effect, but the following
examples illustrate exceptions for rounding UP and to ZERO.
     print "(ru,g11.2)", -9.95
     print "(rz,g11.2)", -9.95
When rounded to two significant digits these are both equal to -9.9,
however following through the rules in the standard it says to use
F7.0 format which will give the result -9. (only one significant
digit).  For positive values, rounding DOWN and to ZERO
     print "(rd,g11.2)", 9.95
     print "(rz,g11.2)", 9.95
both give the result 9.9 according to the rules in the standard.

Q2. Is Gw.d editing intended to use F editing when that produces d
    significant digits?

It usually achieves this, but for
     print "(ru,0p,g11.2)", -99.5
the standard requires 0PE11.2 editing to be used, which gives
     -0.99E+02
even though F7.2 editing can represent it as -99.

Similarly for
     print "(ru,0p,g11.2)", 99.
the standard requires 0PE11.2 editing to be used, which gives
0.99E+02, even though it is representable in F7.2 format as 99.

Q3. COMPATIBLE and NEAREST modes of rounding differ only when the two
    nearest representable values are equidistant from the given
    value.  The similarity appears not to be represented in the second
    table.  What is meant by "if the higher value is even"?

If by "even" we mean the last digit is even, then since we are talking
about a mantissa which is close to 10, COMPATIBLE and NEAREST would
have the same effect.

Q4. The table has no entry for PROCESSOR_DEFINED rounding; since there
    is no value specified for r, it is impossible to interpret the
    table, which seems to indicate that it would not be standard
    conforming to use G editing with PROCESSOR_DEFINED.  How does the
    PROCESSOR_DEFINED I/O rounding mode affect G editing?

Q5. According to 10.7.2.3.7 paragraphs 3 and 4, the effect of NEAREST
    is processor dependent unless IEEE rounding on conversions is
    supported.  How does this affect G editing?

Q6. Consider
        PRINT '(5(1X,1PG9.0))', 0.0, 0.04, 0.06, 0.4, 0.6
    noting that these values are strictly monotonic increasing.
    The standard appears to say that the output should be
        0.E+00  4.E-02  0.      0.      6.E-01
    which is decidedly not monotonic increasing.
    Is this intentional?

ANSWER:

A1. Yes, it is intended to produce output with d significant digits.
    The algorithm for choosing the output form for some I/O rounding
    modes is defective.  An edit is provided to replace this
    algorithm.

A2. Yes.  This is solved by the same edit.

A3. This question is rendered moot by the same edit.

A4. This question is rendered moot by the same edit.

A5. This question is rendered moot by the same edit.

A6.  No.  An edit is supplied to fix this.

EDITS to 10-007r1:

[24:11+] In 1.6.2, insert new paragraph following paragraph 1:
  "The form produced by the G edit descriptor for some values and some
   I/O rounding modes differs from that specified by Fortran 2003."

[24:27+] In 1.6.3, append new bullet item
  "- The form produced by the G edit descriptor with d==0 differs from
     that specified by Fortran 95 for some values.".

[25:6] In 1.6.4, replace the last full stop with semicolon and insert
       new bullet item
  "- the G edit descriptor with d==0 for some values.".

[258:14-]
  Insert new paragraph
    "If \si{d} is zero, \si{k}PE\si{w}.0 or \si{k}PE\si{w}.0E\si{e}
     editing is used for G\si{w}.0 editing or G\si{w}.0E\si{e} editing
     respectively."
{Without the italics markup, this is
    "If d is zero, kPEw.0 or kPEw.0Ee editing is used for Gw.0 editing
     or Gw.0Ee editing respectively."}

[258:15-19]
  Replace the second and subsequent sentences of paragraph 4 including
  the two internal pseudo-tables by

 "If the internal value is a zero value, let $s$ be one.  If the
  internal value is a number other than zero, let \it{N} be the decimal
  value that is the result of converting the internal value to \si{d}
  significant digits according to the I/O rounding mode and let $s$ be
  the integer such that $10^{s-1}$ <= \it{N} < $10^s$.  If $s$<0 or
  $s$>\si{d}, \si{k}PE\si{w}.\si{d} or \si{k}PE\si{w}.\si{d}E\si{e}
  editing is used for G\si{w}.\si{d} editing or G\si{w}.\si{d}E\si{e}
  editing respectively, where \si{k} is the scale factor (10.8.5).
  If 0<=$s$<=\si{d}, the scale factor has no effect and
  F(\si{w}-\it{n}).(\si{d}-$s$),n('b') editing is used where \it{b}
  is a blank and \it{n} is 4 for G\si{w}.\si{d} editing and \si{e}+2
  for G\si{w}.\si{d}E\si{e} editing."
{Note: \it{something} is something in italics,
       \si{something} is a syntax term (in italics),
       and $something$ is LaTeX math notation.
 Without the italics markup, this is
 "If the internal value is a zero value, let s be one.  If the
  internal value is a number other than zero, let N be the decimal
  value that is the result of converting the internal value to d
  significant digits according to the I/O rounding mode and let s be
  the integer such that 10^(s-1) <= N < 10^s.  If
  0<=s<=d, F(w-n).(d-s),n('b') editing is used
  where b is a blank and n is 4 for Gw.d editing
  and e+2 for Gw.dEe editing.  If s<0 or
  s>d, kPEw.d or kPEw.dEe
  editing is used for Gw.d editing or Gw.dEe
  editing respectively."}

SUBMITTED BY: John Reid and Thomas Henlich

HISTORY: 11-174    m195  F08/0055 submitted
         11-174r2  m195  Revised answer - Passed by J3 meeting
         11-241    m196  Failed J3 letter ballot #24 11-229
         11-261    m196  Revised edits - Passed by J3 meeting
         12-165r2  m198  Passed as amended by J3 letter ballot
                          #25 12-147

----------------------------------------------------------------------

NUMBER: F08/0056
TITLE: Non-polymorphic ALLOCATE with polymorphic SOURCE=
KEYWORDS: ALLOCATE, polymorphic, SOURCE=.
DEFECT TYPE: Erratum
STATUS: Passed by J3 meeting

QUESTION:

Consider
  Program m195_m1
    Type t
      Real c
    End Type
    Type,Extends(t) :: t2
      Real d
    End Type
    Class(t),Allocatable :: x
    Type(t),Allocatable :: y
    Allocate(x,Source=t2(1.5,-1.5))
    Allocate(y,Source=x)               ! (*)
    ...
  End Program

Is the second ALLOCATE statement (marked *) standard-conforming?

The only requirement is that Y be type-compatible with X; they both
have the same declared type so this is true.

However, the very similar
  Allocate(y,Source=t2(1.2,-1.5))
would not be conforming because Y is not type-compatible with the
structure constructor, and
  y = x
would also not be conforming (the dynamic types being different).

However, the standard says that
  "the value of [y] becomes that of [x]"
which is clearly impossible.

Since the standard fails to establish an interpretation one might
conclude that the example is not conforming.  However, the similar
situation with the dynamic types being the same but with non-deferred
length type parameters being different is explicitly stated to be
conforming (and to raise an error condition), perhaps this was also
intended to raise an error condition.

It is also possible that the intent was to use the value of the
declared type part in this case, as happens for pointer assignment.

What is the interpretation of this ALLOCATE statement?

ANSWER:

The statement was intended to be conforming and to use the declared
type part of the source-expr only.  An edit is supplied to clarify.

EDIT:

[128:24] In 6.7.1.2p7, before "On successful", insert
  "If an <allocate-object> is not polymorphic and the <source-expr> is
   polymorphic with a dynamic type that differs from its declared
   type, the value provided for that <allocate-object> is the ancestor
   component of the <source-expr> that has the type of the
   <allocate-object>; otherwise, the value provided is the value of
   the <source-expr>."
[128:25-26] Replace "that of <source-expr>" with "the value provided",
            twice.

SUBMITTED BY: Malcolm Cohen

HISTORY: 11-194    m195  Submitted
         11-194r1  m195  Revised answer = passed by J3 meeting
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

----------------------------------------------------------------------

NUMBER: F08/0057
TITLE: Interoperability with empty types.
KEYWORDS: Interoperability, derived type.
DEFECT TYPE: Erratum
STATUS: Passed by J3 meeting

QUESTION:

Consider

  TYPE,BIND(C) :: t
  END TYPE

This is apparently standard-conforming, and interoperates with

  struct t {
  };

However, the latter is not valid syntax according to the
C standard.

How can a type be interoperable with a syntax error?

ANSWER:

The type definition was not intended to be standard-conforming.
An edit is supplied to correct this error.

EDIT:

[431:11-] In 15.3.4, insert new constraint before C1505
  "C1505a (R425) A derived type with the BIND attribute shall have at
          least one component."

SUBMITTED BY: Malcolm Cohen

HISTORY: 11-195    m195  F08/0057 submitted - passed by J3 meeting
         12-165r2  m198  Passed as amended by J3 letter ballot
                          #25 12-147

----------------------------------------------------------------------

NUMBER: F08/0058
TITLE: ENTRY point RESULT variable
KEYWORDS: ENTRY, RESULT
DEFECT TYPE: Erratum
STATUS: Passed by J3 meeting

QUESTION:

MODULE m
  REAL x
CONTAINS
  FUNCTION f()
    f = 1
    x = 2
    RETURN
  ENTRY e() RESULT(x)
    x = 3
  END FUNCTION
END MODULE

Is this standard-conforming?

If so, what is the result of referencing f() and e(), and what effect
does that have on the module variable x?

Note that the standard prohibits dummy arguments of an entry point
from appearing in executable statements ahead of the ENTRY statement
(unless they are also dummy arguments of an earlier ENTRY statement or
the FUNCTION statement), but makes no similar requirement on the
RESULT name.

ANSWER:

This program was not meant to be conforming.

An edit is provided to correct this mistake in the standard.

EDITS to 10-007r1:

Append new statement to 12.6.2.6p8 [310:20],
  "A name that appears as a <result-name> in an ENTRY statement
   shall not appear in any executable statement that precedes the
   first RESULT clause with that name."

Append new statement to 12.6.2.6p9 [310:23]
  "A name that appears as a <result-name> in an ENTRY statement
   shall not appear in the expression of a statement function that
   precedes the first RESULT clause with that name unless the name is
   also a dummy argument of that statement function."

SUBMITTED BY: Malcolm Cohen

HISTORY: 11-196    m195  F08/0058 submitted
         11-196r1  m195  Revised edits - Passed by J3 meeting
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

----------------------------------------------------------------------

NUMBER: F08/0059
TITLE: Auto-targetting requirements
KEYWORDS: POINTER, TARGET, argument association
DEFECT TYPE: Erratum
STATUS: Passed by J3 meeting

QUESTION:

Consider
  PROGRAM one
    REAL,TARGET :: x = 0
    CLASS(*),POINTER :: p
    p => x    ! (0).
    CALL s(p) ! (1).
    CALL s(x) ! (2).
    PRINT *,x
  CONTAINS
    SUBROUTINE s(q)
      CLASS(*),INTENT(IN),POINTER :: q
      IF (ASSOCIATED(q)) THEN
        SELECT TYPE (q)
        TYPE IS (REAL)
          q = q + 1
        END SELECT
      END IF
    END SUBROUTINE
  END PROGRAM

Clearly everything except statement (2) is standard-conforming.

The statement marked (2) violates the requirement in 12.5.2.5
paragraph 2 for the actual argument to be polymorphic when the dummy
argument is a polymorphic pointer.  However, apart from that
requirement, statement (2) is functionally equivalent to the sequence
(0) then (1), so the "auto-targetting" feature does not need this
requirement.

Was this imposition of this requirement (which is needed when both the
actual and the dummy are pointers) an oversight in this case?

Note that similar considerations apply to
   CHARACTER(100),TARGET :: actual
   CHARACTER(:),POINTER,INTENT(IN) :: dummy
in that the pointer assignment would be valid, but the requirements
in 12.5.2.5 paragraph 5 are not met.

ANSWER:

Yes, the imposition of these requirements to the auto-targetting
feature was an oversight.  An edit is supplied to correct this.

EDITS to 10-007r1:

[295:16-17] In 12.5.2.5, Replace paragraph  with
  "The requirements in this subclause apply to an actual argument
   with the ALLOCATABLE or POINTER attribute that corresponds to
   a dummy argument with the same attribute."
{Except for paragraph 4, all these requirements are unnecessary when
 auto-targetting is happening.  Note that 12.5.2.5p6 is moot because
 a coindexed object is not permitted in auto-targetting as it is not
 a valid target in a pointer assignment (C725).}

[296:4-5] Delete paragraph 12.5.2.5p4 and reinsert twice,
          once at [296:12+] as a new paragraph after 12.5.2.6p3, and
          once at [296:35] as a new sentence at the end of 12.5.2.7p3.
{Duplicate the bit about assumed type parameters.}

SUBMITTED BY: Malcolm Cohen

HISTORY: 11-197    m195  F08/0059 submitted
         11-197r1  m195  Revised editing instructions - Passed by J3
                          meeting
         12-165r2  m198  Passed as amended by J3 letter ballot
                          #25 12-147

----------------------------------------------------------------------

NUMBER: F08/0060
TITLE: Procedure pointer assignment with an EXTERNAL target.
KEYWORDS: Procedure pointer, pointer assignment, EXTERNAL attribute.
DEFECT TYPE: Erratum
STATUS: Passed by J3 meeting

QUESTION:

Consider

  Program m5
    Print *,f()
    Call s
  Contains
    Subroutine s
      Procedure(Real),Pointer :: p
      Print *,g()
      p => f                           ! (1)
      Print *,p()
      p => g                           ! (2)
      Print *,p()
    End Subroutine
  End Program
  Function f()
    f = 1
  End Function
  Function g()
    g = 2
  End Function

is this program standard-conforming?

On the face of it, both (1) and (2) violate constraint C729, which
only allows an external procedure
  "that is accessed by use or host association and is referenced in
   the scoping unit as a procedure or that has the EXTERNAL
   attribute".
The function f is accessed by host association but is not referenced
in the scoping unit as a procedure, whereas the function g is
referenced in the scoping unit as a procedure but is not accessed by
use or host association.

Furthermore, consider

  Program m5a
    Real,External :: f,p
    Pointer p
    p => f                       ! (3)
    Print *,p()
  End Program
  ! function f as above.

Is this conforming?  The constraint has a single clause for external
procedures with no commas but with a disjunction and a conjunction,
therefore it is ambiguous whether it means
   "accessed by use or host association" AND
    ("is referenced in the scoping unit as a procedure" OR
     "has the external attribute")
or whether it means
   ("accessed by use or host association" AND
    "is referenced in the scoping unit as a procedure") OR
     "has the external attribute")

Since the standard does not unambiguously give an interpretation of
this program it seems that statement (3) is also not conforming.

Which of these three procedure pointer assignment statements were
intended to be conforming?

DISCUSSION:

The wording of this constraint was determined by Interp F03/0138,
which intended to change it to

  "C727 (R742) A <procedure-name> shall be the name of a module or
        dummy procedure, a specific intrinsic function listed in 13.6
        and not marked with a bullet ($\bullet$), a procedure pointer,
        or an external procedure that is accessed by use or host
        association, referenced in the scoping unit as a procedure, or
        that has the EXTERNAL attribute."

but a last-minute "editorial" change at the WG5 ballot stage made it

  "C727 (R742) A <procedure-name> shall be the name of a module or
        dummy procedure, a specific intrinsic function listed in 13.6
        and not marked with a bullet ($\bullet$), a procedure pointer,
        or an external procedure that is accessed by use or host
        association and is referenced in the scoping unit as a
        procedure, or that has the EXTERNAL attribute."

instead, and the comma got lost in between there and Fortran 2008.
Despite supposedly being an editorial change, the WG5 wording has
different technical results.

According to the original wording of the interp, all three examples
above were intended to be allowed.

ANSWER:

All three pointer assignment statements were intended to be valid.
An edit is supplied to correct the error in the standard.

EDITS to 10-007r1:

[158:33-159:2] In 7.2.2.2, C729,
  replace "an external ... bullet ($\bullet$)"
  with
    "a specific intrinsic function listed in 13.6 and not marked with
     a bullet ($\bullet$), or an external procedure that is accessed
     by use or host association, referenced in the scoping unit as a
     procedure, or that has the EXTERNAL attribute".
{NB: $\bullet$ is the LaTeX command that produces a bullet.}

SUBMITTED BY: Malcolm Cohen

HISTORY: 11-198    m195  F08/0060 submitted - Passed by J3 meeting
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

----------------------------------------------------------------------

NUMBER: F08/0061
TITLE: Description of the CONTIGUOUS attribute misworded?
KEYWORDS: CONTIGUOUS
DEFECT TYPE: Erratum
STATUS: Passed by J3 meeting

Consider the following code:

module mod_cont
contains
  subroutine fcont(x)
    real, contiguous :: x(:)
    integer :: i
    x = (/ (real(i),i=1,size(x)) /)
  end subroutine fcont
end module mod_cont
program cont
  use mod_cont
  implicit none
  real :: x(45)

  call fcont(x(1::3))

end program

Is this program standard conforming?

5.3.7 paragraph 1 says:

"The CONTIGUOUS attribute specifies that an assumed-shape array can
 only be argument associated with a contiguous effective argument, or
 that an array pointer can only be pointer associated with a
 contiguous target."


ANSWER:

Yes.  The effect of the CONTIGUOUS attribute is misstated.  An edit
is supplied to correct this.

EDITS for 10-007r1:

[93:7-8] In 5.3.7p1,
  Change
   "can only be argument associated with a contiguous effective
    argument"
  to
   "is contiguous".

SUBMITTED BY: Reinhold Bader

HISTORY: 11-199r1  m195  F08/0061 submitted
         11-199r1  m195  Revised edits
         11-199r2  m195  Revised edits - Passed by J3 meeting
         12-165r2  m198  Passed as amended by J3 letter ballot
                          #25 12-147

----------------------------------------------------------------------

NUMBER: F08/0062
TITLE: Mixing default initialization with DATA initialization
KEYWORDS: DATA, default initialization, explicit initalization
DEFECT TYPE: Clarification
STATUS: Passed by J3 meeting

QUESTION:

In the following program, one component has a default initialization
and the other is initialized in a DATA statement. Is the program
valid?

  module oad_active
    implicit none
    type active
      integer :: v
      integer :: d = 42
    end type
  end module

  module tots_c
    use oad_active
    implicit none
    type(active), save :: trlkold
    data trlkold%v /100/
  end module

  program foo
    use tots_c
    implicit none
    if (trlkold%d /=  42) stop 'ERROR d /= 42'
    if (trlkold%v /= 100) stop 'ERROR v /= 100'
  end program foo


WG5/N1830 has [p104, 5.4.7, parag. 2]

  If a nonpointer object has default initialization, it shall not
  appear in a <data-stmt-object-list>.

and [p89, 5.2.3, parag. 1]

  Explicit initialization alternatively may be specified in a DATA
  statement unless the variable is of a derived type for which default
  initialization is specified. [...] A variable, or part of a
  variable, shall not be explicitly initialized more than once in a
  program.

and [p70, 4.5.4.6, parag. 6]

  Explicit initialization in a type declaration statement (5.2)
  overrides default initialization


ANSWER:

It was intended that the data statement not be conforming.

5.4.7p2 was carefully worded to use "shall not appear" rather than
"shall not be the <data-stmt-object>".

The intention was that an object be initialized entirely in a type
declaration statement, or that only those parts of it having default
initialization be initialized.  It was considered to be a burden on
processors to be required to initialize some parts of a structure
using default initialization, and other parts of it explicitly.

EDITS to 10-007r1:

None.

SUBMITTED BY: Tobias Burnus

HISTORY: 11-201    m195  F08/0062 submitted
         11-201r1  m195  Draft answer - Passed by J3 meeting
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

----------------------------------------------------------------------

NUMBER: F08/0063
TITLE: G editing to a narrow output field
KEYWORDS: G edit descriptor, narrow field, asterisks
DEFECT TYPE: Interpretation
STATUS: Passed by J3 meeting

QUESTION:

What will be the output for the following program:

     PROGRAM MAIN
       PRINT '(G6.5)', 1.0
     END

Will it print six asterisks ("*****") or 2 followed by four blanks
("**    ")?

According to subclause 10.7.5.2.2, because
   0.1-0.5E-6 <= 1.0 < 1E5 - 0.5
this will do F editing, and according to the table that means
  F2.4,4(' ')

ANSWER:

10.7.2.3.2 says
  "the field occupies w positions, the fractional part of which
   consists of d digits"
and this does not make sense if w<d.  Therefore, according to the
first sentence of 1.5 Conformance, the program is not standard
conforming.

There are therefore no requirements on the processor for this
program, and it may produce either output, or even a runtime error.

EDITS:

None.

SUBMITTED BY: Tobias Burnus

HISTORY: 12-102    m197  F06/0063 submitted
         12-102r1  m187  Passed by J3 meeting
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

----------------------------------------------------------------------

NUMBER: F08/0064
TITLE: STATUS of GET_ENVIRONMENT_VARIABLE
KEYWORDS: GET_ENVIRONMENT_VARIABLE
DEFECT TYPE: Erratum
STATUS: Passed by J3 meeting

QUESTION:

Assuming the processor supports environment variables, consider

  Program m197_m1
    Call Get_Environment_Variable(Name='HOME',Length=n,Status=istatus)
    Print *,istatus
    If (istatus==0) Print *,n
  End Program

If the environment variable HOME does not exist,
this program is obviously standard-conforming and prints the value 1
(STATUS paragraph of 13.7.67).

If the environment variable HOME does exist but has "no value",
this program is obviously standard-conforming and prints the value 0
(STATUS paragraph) and then prints the value 0 (LENGTH paragraph).

Aside: Indeed, if a VALUE argument is supplied, it seems that "no
       value" is the same as "zero-length value" in that no difference
       between them is discernable in a standard-conforming program.

"Inconvenience 1":
If the environment variable HOME does exist, and has a value whose
length is zero, the program appears to be not standard-conforming as
no interpretation is established: there is no specification of the
value to be assigned to the STATUS argument.  This relies on their
being a difference between "no value" and "zero-length value".

"Inconvenience 2":
If the environment variable HOME does exist, and has a value whose
length is not zero, the program is definitely not standard-conforming
as no interpretation is established w.r.t. the STATUS argument.

Thus, even though VALUE is optional, it would seem that it is not
permitted to omit it except when enquiring the existence of an
environment variable that does not exist.

Was it really intended to be impossible to enquire the existence and
length of the environment variable without attempting to fetch it?

ANSWER:

No, this was not intended.  An edit is supplied to correct this.

EDIT:

[351:18] After "either has no value" change "or" to a comma.
         After "assigned to VALUE,"
         insert "or the VALUE argument is not present,".

SUBMITTED BY: Malcolm Cohen

HISTORY: 12-103   m197 F08/0064 submitted
	 12-103r1 m197 Revised Edit - passed by J3 meeting
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

----------------------------------------------------------------------

NUMBER: F08/0065
TITLE: Should certain procedures in intrinsic modules be pure?
KEYWORDS: pure, intrinsic, intrinsic module
DEFECT TYPE: Erratum
STATUS: Passed by J3 meeting

QUESTION:

1.  12.7 doesn't allow a procedure in an intrinsic module to be pure
    unless it's actually defined by a pure subprogram (as opposed to
    being provided by the processor).  Nonetheless, some of the
    procedures in IEEE_Arithmetic are specified to be pure.  How can
    they be pure?

2.  The COMPILER_OPTIONS and COMPILER_VERSION functions in the
    intrinsic module ISO_Fortran_env are not described as being pure,
    but there is no apparent reason for any of them to be impure.
    Were they intended to be pure?

3.  The procedures in ISO_C_Binding are not specified to be pure, but
    there is no apparent reason for any of them to be impure.  Were
    they intended to be pure?

ANSWER:

1.  The list in subclause 12.7, paragraph 1, is incomplete.  An edit
    is supplied to correct it.

2.  The procedures were intended to be pure.  An edit is supplied to
    correct this oversight.

3.  The procedures were not intended to be pure.

EDITS:

1: [12.7p1 312:12+] Insert a list item
" o a module procedure in an intrinsic module, if it is specified to
    be pure,"

2: [13.8.2.1p2 397:7] Append a sentence to the paragraph:
"The module procedures described in 13.8.2 are pure."

SUBMITTED BY: Van Snyder

HISTORY: 12-104    m197  F08/0065 submitted
         12-104r1  m197  Revised
         12-104r2  m197  Revised - passed by J3 meeting
         12-165r2  m198  Passed as amended by J3 letter ballot
                          #25 12-147

----------------------------------------------------------------------

NUMBER: F08/0066
TITLE: Are certain expressions with pointer initialization constant?
KEYWORDS: constant, pointer initialization
DEFECT TYPE: Erratum
STATUS: Passed by J3 meeting

QUESTION:

Given

    type :: T
      character(len=:), pointer :: P
    end type T
    character(len=10), target, save :: V

(1) Is the expression T(V) a constant expression?

If so, consider the additional statement

  TYPE(T),PARAMETER :: Z = T(V)

(2) Is the expression
      TRANSFER(SQRT(TRANSFER(Z,R)),Z)
    a constant expression?

(3) Is the expression Z%P a constant expression?

(4) Is the assignment
      Z%P = 'NEW VALUE'
    a valid assignment?

ANSWER:

(1) Yes.

(2) An expression involving TRANSFER of an initialization target was
    not intended to be classified as a constant expression.  An edit
    is provided to correct this.

(3) Except in pointer association context, no (see 6.4.2p5).

(4) Yes.  In this context, Z%P is not a subobject of Z.

EDITS to 10-007r1:

[152:4] 7.1.12 "Constant expression", p1, item (6),
	After "THIS_IMAGE" insert ", or TRANSFER".
{Exclude the general case of TRANSFER from constant expressions.}

[152:6+] After item (7) "... NULL ...", insert new item
   "(7a) A reference to the intrinsic function TRANSFER where each
         argument is a constant expression and each ultimate pointer
         component of the SOURCE argument is disassociated."
{Exclude the problematic case without introducing an incompatibility
 with Fortran 95.}

SUBMITTED BY: Van Snyder

HISTORY: 12-106    m197  F08/0066 submitted
	 12-106r1  m197  Revised answer - passed by J3 meeting
         12-165r2  m198  Passed as amended by J3 letter ballot
                          #25 12-147

----------------------------------------------------------------------

NUMBER: F08/0067
TITLE: Passing arrays of extended type objects
KEYWORDS: assumed-size arrays, extended type
DEFECT TYPE: Erratum
STATUS: Passed by J3 meeting

QUESTION:

Can an assumed-size array of extended type be passed as an actual
argument to a nonpolymorphic dummy array whose type is the parent
type of the extended type?

Clause 6.5.2 "Whole arrays" [121:10-12] permits an assumed-size
array to appear as an actual argument in a procedure reference.
Consider the program

      MODULE TYPES
        TYPE REC
          INTEGER A
        END TYPE
        TYPE, EXTENDS(REC) :: REC2
          INTEGER B
        END TYPE
      END

      SUBROUTINE SUB1(A, N)
        USE TYPES
        CLASS(REC), INTENT(IN) :: A(*)
        CALL SUB2(A, N)
      END

      SUBROUTINE SUB2(A, N)
        USE TYPES
        TYPE(REC) A(*)
        PRINT *, A(:N)%A
      END

      PROGRAM MAIN
        USE TYPES
        CLASS(REC), ALLOCATABLE :: A(:)
        INTERFACE
          SUBROUTINE SUB1(A, N)
            USE TYPES
            CLASS(REC), INTENT(IN) :: A(*)
          END SUBROUTINE
        END INTERFACE

        ALLOCATE (A, SOURCE = (/(REC2(I, -I), I = 1, 10)/))
        CALL SUB1(A, 10)
      END

The subroutine reference in SUB1 that invokes SUB2 appears to be
standard conforming according to that clause.  Is that intended?

ANSWER:

The invocation of SUB2 in SUB1 requires the shape, and therefore
the example is not standard-conforming.

An edit is supplied to clarify this.

EDIT to 10-007r1:

[293:5] In 12.5.2.4 Ordinary dummy variables, paragraph 2, append
  "If the actual argument is a polymorphic assumed-size array,
   the dummy argument shall be polymorphic."

SUBMITTED BY: Robert Corbett

HISTORY: 12-114    m197  F08/0067 submitted
	 12-114r1  m197  Draft answer - passed by J3 meeting
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

----------------------------------------------------------------------

NUMBER: F08/0068
TITLE: Pointer association and extended type arrays
KEYWORDS: pointer association, extended type
DEFECT TYPE: Erratum
STATUS: Passed by J3 meeting

QUESTION:

Should a pointer that is pointer associated with a dummy array or an
element or section of a dummy array remain associated after return
from the procedure that contains the dummy array if the dummy array
is not polymorphic and the dynamic type of the effective argument of
the dummy array is not the same as the type of the dummy array?

ANSWER:

It was not intended to be possible for a nonpolymorphic dummy
argument to be associated with an effective argument with an
incorrect dynamic type.  An edit is supplied to fix this.

EDITS to 10-007r1:

[292:16] 12.5.2.3p2,
  Change "the dummy argument" to a bullet item with
    "if the dummy argument is polymorphic, it"
  Insert after "that target" a semi-colon and another bullet item
    "if the dummy argument is nonpolymorphic, it becomes argument
     associated with the declared type part of that target".
Making the whole paragraph read:
  "If a nonpointer dummy argument without the VALUE attribute
   corresponds to a pointer actual argument that is pointer associated
   with a target,
     - if the dummy argument is polymorphic, it becomes argument
       associated with that target;
     - if the dummy argument is nonpolymorphic, it becomes argument
       associated with the declared type part of that target".

[292:18] p3
  Change "it" to a bullet item with
    "if the dummy argument is polymorphic, it",
  Insert after "that actual argument" a semi-colon and another bullet
  item
    "if the dummy argument is nonpolymorphic, it becomes argument
     associated with the declared type part of that actual argument".
Making the whole paragraph read:
  "If a present nonpointer dummy argument without the VALUE attribute
   corresponds to a nonpointer actual argument,
   - if the dummy argument is polymorphic it becomes argument
     associated with that actual argument;
   - if the dummy argument is nonpolymorphic, it becomes argument
     associated with the declared type part of that actual argument".

SUBMITTED BY: Robert Corbett

HISTORY: 12-116    m197  F08/0068 submitted
	 12-116r1  m197  Revised - passed by J3 meeting
         12-165r2  m198  Passed as amended by J3 letter ballot
                          #25 12-147

----------------------------------------------------------------------

NUMBER: F08/0069
TITLE: Which part of an effective argument becomes undefined?
KEYWORDS: INTENT(OUT), extended type
DEFECT TYPE: Erratum
STATUS: Passed by J3 meeting

QUESTION:

The last sentence of paragraph 17 of Clause 12.5.2.4
[294:42-295:2] states

     If the dummy argument is not polymorphic and the type of
     the effective argument is an extension of the type of the
     dummy argument, only the part of the effective argument
     that is of the same type as the dummy argument becomes
     undefined.

The effective argument might have several parts that are of the
same type as the dummy argument.  Should the sentence say that
only the ancestor component of the effective argument that has
the same type as the dummy argument becomes undefined?

A possible edit is to replace the last sentence of paragraph 17
of Clause 12.5.2.4 with

     If the dummy argument is not polymorphic and the type of
     the dummy argument is the type of an ancestor
     component (4.5.7.2) of the effective argument, only that
     component of the effective argument becomes undefined.

ANSWER:

A nonpolymorphic dummy argument should not be able to be argument
associated with an effective argument that has a different dynamic
type.  That mistake was corrected by interpretation F08/0068.

The quoted text from the standard is therefore a mistake; an edit
is supplied to correct it.

EDITS to 10-007r1:

[294:40] 12.5.2.4p17, after "has INTENT (OUT),"
	 change "the actual argument" to "the effective argument".
{It is the effective argument that we intended to become undefined,
 not the whole actual argument in the case of polymorphism.}

[294:42-295:2] Delete last sentence "If ... undefined."
{No longer possible.}

SUBMITTED BY: Robert Corbett

HISTORY: 12-117    m197  F08/0069 submitted
	 12-117r1  m197  Draft answer - passed by J3 meeting
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

----------------------------------------------------------------------

NUMBER: F08/0070
TITLE: Finalization of INTENT(OUT) arguments
KEYWORDS: finalization INTENT(OUT)
DEFECT TYPE: Erratum
STATUS: Passed by J3 meeting

QUESTIONS:

The following questions assume the new text for paragraph 8 of
Clause 4.5.6.3 provided in Corrigendum 1.  The new text states

     When a procedure is invoked, an object that becomes
     argument associated with a nonpointer, nonallocatable
     INTENT(OUT) dummy argument of that procedure is
     finalized.  The finalization caused by INTENT(OUT) is
     considered to occur within the invoked procedure; so
     for elemental procedures, an INTENT(OUT) argument will
     be finalized only if a scalar or elemental final
     subroutine is available, regardless of the rank of the
     actual argument.

Question 1:

Suppose an explicit-shape dummy array is argument associated with an
array that has more elements than the dummy array.  Are all of the
elements of the effective argument of the dummy array finalized or
are only those elements associated with elements of the dummy array
finalized?

Question 2:

The last sentence of paragraph 17 of Clause 12.5.2.4 states

     If the dummy argument is not polymorphic and the type of
     the effective argument is an extension of the type of the
     dummy argument, only the part of the effective argument
     that is of the same type as the dummy argument becomes
     undefined.

In such a case, is the entire effective argument finalized or is only
the part of the effective argument that becomes undefined finalized?

Question 3:

Is the argument finalized before it becomes undefined?

Question 4:

If so, can its value be used in a specification expression?

ANSWERS:

A1. Only the part properly associated with the dummy argument was
    intended to be finalized; an edit is supplied to clarify this.

A2. This is answered by interpretations F08/0068 and F08/0069;
    the quoted text has been deleted.

A3. Yes.  This is clarified by the same edit as for question 1.

A4. No, because it becomes undefined on procedure invocation.

EDITS:

Delete, in the quoted text for paragraph 8 of Clause 4.5.6.3 provided
in Corrigendum 1,
  "an object that becomes argument associated with"
and after "is finalized" insert
  "before it becomes undefined"
Making the whole paragraph read
    "When a procedure is invoked, a nonpointer, nonallocatable
     INTENT(OUT) dummy argument of that procedure is finalized before
     it becomes undefined.  The finalization caused by INTENT(OUT) is
     considered to occur within the invoked procedure; so for
     elemental procedures, an INTENT(OUT) argument will be finalized
     only if a scalar or elemental final subroutine is available,
     regardless of the rank of the actual argument."

SUBMITTED BY: Robert Corbett

HISTORY: 12-118    m197  F08/0070 submitted
	 12-118r1  m197  Draft answer - passed by J3 meeting
         12-165r2  m198  Passed as amended by J3 letter ballot
                          #25 12-147

----------------------------------------------------------------------

NUMBER: F08/0072
TITLE: Final subroutines with corank
KEYWORDS: FINAL subroutine, finalization, coarrays, codimension,
corank
DEFECT TYPE: Erratum
STATUS: Passed by J3 meeting

QUESTION:

Is it intentional that final subroutines with coarray dummy arguments
are allowed?

ANSWER:

No. An edit is supplied to correct this.

EDITS to 10-007r1:

In C480 [4.5.6.1 10-007r1:75:10] in the second sentence, add
"noncoarray," before "nonpointer".

SUBMITTED BY: Tobias Burnus

HISTORY: 12-125    m197  F08/0072 submitted
         12-125r1  m197  Revised, same answer with 10-007r1
                          references - passed by J3 meeting
         12-165r2  m198  Passed by J3 letter ballot #25 12-147

----------------------------------------------------------------------

NUMBER: F08/0073
TITLE: Polymorphic auto-targetting
KEYWORDS: polymorphic, pointer, dummy
DEFECT TYPE: Erratum
STATUS: Passed by J3 meeting

QUESTION:

Consider

  Program m013
    Type t
      Real c
    End Type
    Type(t),Target :: x
    Call s(x)
    Print *,x%c
  Contains
    Subroutine s(p)
      Class(t),Pointer,Intent(In) :: p
      p%c = 3
    End Subroutine
  End Program

Is the invocation of S standard-conforming?

According to 12.5.2.5p2, because dummy P is polymorphic,
the actual argument is required to be polymorphic, even
though the dummy argument is not associated with the
actual argument.

ANSWER:

The invocation of S was intended to be standard-conforming;
the polymorphism-matching requirement in 12.5.2.5 was intended
to apply only when both the actual and dummy arguments were
pointers (or allocatables).

An edit is supplied to correct this mistake.

EDITS to 10-007r1:

[295:18] 12.5.2.5p2, change "The" to
  "Except in the case where the dummy argument is a pointer and the
   actual argument is not a pointer, the"

Note: This edit will be completely unnecessary if interp F08/0059
      passes with its current edits (or similar).

SUBMITTED BY: Malcolm Cohen

HISTORY: 12-131    m197  F08/0073 submitted - passed  by J3 meeting
         12-165r2  m198  Passed as amended by J3 letter ballot
                          #25 12-147

----------------------------------------------------------------------

--------------050004020502090409080609--

