J3/10-148 To: J3 Subject: Interpretation concerning intrinsic functions with DIM argument From: Van Snyder Date: 2010 April 01 ---------------------------------------------------------------------- NUMBER: F08/xxxx TITLE: Is a disassociated pointer allowed as an actual DIM argument? KEYWORDS: DIM argument DEFECT TYPE: Erratum STATUS: Under consideration QUESTION: Several intrinsic functions, such as ANY, have a DIM argument, with the rank of the result depending upon whether it is present. There is a prohibition against the actual argument being an optional dummy argument, but not against it being a disassociated pointer or deallocated allocatable. Is the following program standard conforming, and if so what does it print? program DIM_Arg integer, pointer :: Dim => NULL() logical :: Mask(2,2) = & & reshape( (/ .true., .false, .false, .true. /), (/ 2, 2 /) ) print *, shape( any(mask,dim) ) end program DIM_Arg ANSWER: The description worked until we allowed a disassociated pointer or unallocated allocatable variable that is associated with a nonpointer nonallocatable optional argument to be interpreted not to be present. It was intended that this program not conform. It was an oversight that disassociated pointer and unallocated allocatable actual arguments were not prohibited to correspond to DIM dummy arguments for these intrinsic functions. Edits are provided to clarify this, but using a different strategy from simply prohibiting those kinds of arguments. EDITS: [13.2.4p1] Replace "present" by "it appears". Delete the third sentence, viz. "The DIM argument ... optional dummy argument." Better yet, just delete 13.2.4. [13.7.10] Replace the subclause heading by "ALL ( MASK, DIM ) or ALL ( MASK )" [13.7.10p3] In the description of the DIM argument, delete "(optional)" and the second sentence, viz. "The corresponding ... optional dummy argument." [13.7.10p4] In the description of Result Characteristics, replace "is absent" by "does not appear". [13.7.13] Replace the subclause heading by "ANY ( MASK, DIM ) or ANY ( MASK )" [13.7.13p3] In the description of the DIM argument, delete "(optional)" and the second sentence, viz. "The corresponding ... optional dummy argument." [13.7.13p4] In the description of Result Characteristics, replace "is absent" by "does not appear". [13.7.90] Replace the subclause heading by "LBOUND ( ARRAY, DIM [, KIND ] ) or LBOUND ( ARRAY [, KIND ] )" [13.7.90p3] In the description of the DIM argument, delete "(optional)" and the second sentence, viz. "The corresponding ... optional dummy argument." [13.7.90p4] In the description of Result Characteristics, replace "DIN is present" by "DIM appears". [13.7.91] Replace the subclause heading by "LCOBOUND ( COARRAY, DIM [, KIND ] ) or LCOBOUND ( COARRAY [, KIND ] )" [13.7.91p3] In the description of the DIM argument, delete "(optional)" and the second sentence, viz. "The corresponding ... optional dummy argument." [13.7.91p4] In the description of Result Characteristics, replace "DIM is present" by "DIM appears". [13.7.123] Replace the subclause heading by "NORM2 ( X, DIM ) or NORM2 ( X )" [13.7.123p3] In the description of the DIM argument, delete "(optional)" and the second sentence, viz. "The corresponding ... optional dummy argument." [13.7.123p4] In the description of Result Characteristics, replace "is absent" by "does not appear". [13.7.128] Replace the subclause heading by "PARITY ( MASK, DIM ) or PARITY ( MASK )" [13.7.128p3] In the description of the DIM argument, delete "(optional)" and the second sentence, viz. "The corresponding ... optional dummy argument." [13.7.128p4] In the description of Result Characteristics, replace "is absent" by "does not appear". [13.7.171] Replace the subclause heading by "UBOUND ( ARRAY, DIM [, KIND ] ) or UBOUND ( ARRAY [, KIND ] )" [13.7.171p3] In the description of the DIM argument, delete "(optional)" and the second sentence, viz. "The corresponding ... optional dummy argument." [13.7.171p4] In the description of Result Characteristics, replace "DIM is present" by "DIM appears". [13.7.172] Replace the subclause heading by "UCOBOUND ( COARRAY, DIM [, KIND ] ) or UCOBOUND ( COARRAY [, KIND ] )" [13.7.172p3] In the description of the DIM argument, delete "(optional)" and the second sentence, viz. "The corresponding ... optional dummy argument." [13.7.172p4] In the description of Result Characteristics, replace "DIM is present" by "DIM appears". SUBMITTED BY: Van Snyder HISTORY: ----------------------------------------------------------------------