[comp.unix.aix] xlf Parameter statements

gravishanker@eagle.wesleyan.edu (03/08/91)

Hi

I found a strange behaviour on an IBM RISC/6000 (running AIX V 3.1) while
compiling a Fortran '77 program. It is so strange that it took a while before
nailing the problem down, so I thought I will share it here. The problem has
been tested even after the 3003 maintainance upgrade, which for us also meant
going to Version 2 of xlf. On a Silicon Graphics Iris or on a Vax, the
statement

	Parameter a=10.

is accepted and a is assigned the value correctly. The xlf compiler does not
issue any compilation error, but does not assign anything for a. This is a
parsing problem and if you print the value of parametera that has the value of
10. The expected syntax is,

	Parameter (a=10.)

and I think, ( acts as the lookahead token for parsing the Parameter statement. 

On the other hand, xlf complains for 

	Parameter a=10.,b=-9.

and enclosing the assignments in parantheses solves the compiler error. Of
course, the Iris and Vax are perfectly happy with this type of statement.

Ravi

DYAEB@SLACVM.SLAC.STANFORD.EDU (David Aston) (03/11/91)

In article <1991Mar7.210849.39890@eagle.wesleyan.edu>,
gravishanker@eagle.wesleyan.edu says:
>
>  [stuff deleted]
>    The expected syntax is,
>
>        Parameter (a=10.)
>
 This is the correct ANSI FORTRAN77 form of the parameter statement.
>
>On the other hand, xlf complains for
>
>        Parameter a=10.,b=-9.
>
>and enclosing the assignments in parantheses solves the compiler error. Of
>course, the Iris and Vax are perfectly happy with this type of statement.

 This behaviour is strictly correct. Iris, Vax (and I'm sure other)
 compilers only accept it as an extension. When only one parameter is
 given the syntax is ambiguous, since blanks are not significant in Fortran,
 and the variable Parametera gets correctly set to 10.
 As someone once said (I forget who), "the nice thing about standards is
 that there are so many of them to choose from".  ;-)

shair@ux1.cso.uiuc.edu (Bob Shair) (03/11/91)

If memory serves, this standard is (also) relaxed in xlf V2 which
I hope everyone has now placed on order.
-- 
Bob Shair                          shair@chgvmic1.iinus1.ibm.com
Scientific Computing Specialist    SHAIR@UIUCVMD (bitnet)
IBM Champaign