Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!topaz!ll-xn!nike!ucbcad!ucbvax!decvax!decwrl!pyramid!hplabs!felix!scgvaxd!wlbr!jplgodo!steve From: steve@jplgodo.UUCP Newsgroups: net.lang.f77 Subject: Re: possible implied-do bug? Message-ID: <816@jplgodo.UUCP> Date: Thu, 26-Jun-86 13:27:13 EDT Article-I.D.: jplgodo.816 Posted: Thu Jun 26 13:27:13 1986 Date-Received: Sun, 29-Jun-86 05:33:08 EDT References: <1452@alvin.mcnc.UUCP> Organization: Jet Propulsion Labs, Pasadena, CA Lines: 83 Keywords: implied do, parenthesis In article <1452@alvin.mcnc.UUCP>, kenkel@mcnc.UUCP (Stephen Kenkel) writes: > The following program compiles under VMS fortran, but not f77: > > dimension l(10),m(10),n(10) > write (*, * ) i,((l(k), m(k), n (k)), k=1,10) > end > > This version works: > > dimension l(10),m(10),n(10) > write (*, * ) i,(l(k), m(k), n (k), k=1,10) > end > > The extra parenthesis around the items in the implied do list > appears to be causing trouble. Is this a bug, or is the compiler > in compliance with the standard? It looks like f77 is complying with the standard and VMS Fortran has relaxed the requirements. Quoting from the ANSI standard: 12.8.2.3 Implied-DO List. An implied-DO list if of the form: ( dlist, i = e1, e2 [,e3] ) where: i, e1, e2, and e3 are as specified for the DO statement (11.10) dlist is an input/output list ....... 12.8.2 Input/Ouput List. ..... An input/output list is a list (2.10) of input/output list items and implied-DO lists (12.8.2.3). An input/output list item is either an input list item or an output list item. ..... 12.8.2.2 Output list items. An output list item must be one of the following: (1) A variable name (2) An array element name (3) A character substring name (4) An array name (5) Any other expression except a character expression involving concatenation of an operand whose length specification is an asterisk in parentheses unless the operand is the symbolic name of a constant. Note that a constant, an expression involving operators or function references, or an expression enclosed in parentheses may appear as an output list item but must not appear as an input list item. 2.10 List A list is a nonempty sequence (2.1) of syntactic entities seperated by commas. The entities in the list are called list items. Essentially, the stuff after the ( in an implied-DO list before the indexing information must be a valid I/O list. The only time parentheses are allowed in an I/O list is surrounding an expression or surrounding an implied-DO list. A sequence of things seperated by commas is certainly not a valid Fortran expression. Since there is no loop index information given, it is not a valid implied-DO list either. Therefore it is not a valid I/O list item. Editorial remark: It has been my experience that VMS Fortran is *very* liberal in what it will accept as valid Fortran. If you care at all about being portable, get a copy of the ANSI standard and throw away your vendor's manuals. The other recommendation I would make is to always use the /STANDARD qualifier when you compile on a VAX. This should flag most of the non-standard extensions you are using. I don't know how picky this is on a VAX since all of my developement work is done on a Ridge but it should help. -- ...smeagol\ Steve Schlaifer ......wlbr->!jplgodo!steve Advance Projects Group, Jet Propulsion Labs ....logico/ 4800 Oak Grove Drive, M/S 156/204 Pasadena, California, 91109 +1 818 354 3171