Error: Invalid form of array reference at (1)

Tobias Burnus burnus@net-b.de
Tue Feb 8 21:10:00 GMT 2011


Am 08.02.2011 21:43, schrieb Steve Kargl:
>                         1
> Error: Invalid form of array reference at (1)
>
>
> So, yes, your lines are too long.  IMNSHO, anything over
> 80 characters is too long.

The Fortran standard allows only 132 characters in free-form source code 
and 72 in fixed-form source code. Thus, it is not surprising that you 
get such an error exactly in column 132.  As Steve already wrote, you 
should split long lines using an ampersand (&) as last character in the 
line which should be continued.

Alternatively, you can ask gfortran to accept longer line lengths using, 
e.g., -ffree-line-length-none (or -ffree-line-length-<n> where "<n>" is 
a number).

Regarding the number 80: I read in the gfortran manual that 80 matches 
old card images and it is also a typical width of many terminals. Thus, 
restricting one to maximally 80 characters is a good practice and also 
GNU coding style (for C). However, in terms of Fortran only 72 and 132 
are the magic numbers.

Tobias



More information about the Fortran mailing list