(j3.2006) contradiction in CO_REDUCE

Bill Long longb
Thu Jan 16 16:34:58 EST 2014

On Jan 16, 2014, at 3:14 PM, John Reid <John.Reid at stfc.ac.uk> wrote:

> Bill Long wrote:
>> Deepak from Univ of Houston pointed out a contradiction we have in the specification of CO_REDUCE.  We say that OPERATOR ?shall be a pure elemental function with two arguments...?.  But C1234 prohibits such a procedure as an actual argument. !!    We can fix this by changing the requirement for OPERATOR to ?shall be a pure function with two scalar argument??.
> Surely we want it to be elemental since SOURCE may be any array. Note 
> that SUM, MAX, MIN are elemental. How about adding this as an exception 
> on C1234:

But the compiler knows about SUM, MAX, MIN, and can make the appropriate accommodations if necessary. 

> C1234 (R1223) A nonintrinsic elemental procedure shall not be used as an 
> actual argument except in an invocation of the intrinsic subroutine 

Except that there is a reason for the constraint in the first place, and I don?t see how CO_REDUCE is sufficiently special to ignore that.  If we require that OPERATOR have two scalar dummy arguments of the right type, then for an array SOURCE in a CO_REDUCE call,  the operation is just applied to elements. 


> John.
> _______________________________________________
> J3 mailing list
> J3 at mailman.j3-fortran.org
> http://mailman.j3-fortran.org/mailman/listinfo/j3

Bill Long                                                                       longb at cray.com
Fortran Technical Suport  &                                  voice:  651-605-9024
Bioinformatics Software Development                     fax:  651-605-9142
Cray Inc./ Cray Plaza, Suite 210/ 380 Jackson St./ St. Paul, MN 55101

More information about the J3 mailing list