Data implied do

Roger Ferrer Ibáñez rofi@ya.com
Mon Aug 1 15:20:00 GMT 2005


Hi,

the following snippet gives an error with GNU Fortran (at least GCC 
4.1.0 20050730) while it compiles fine with other f95 compilers (I've 
tested with Intel and Sun ones).

  PROGRAM p
   REAL ONE_ARRAY(100, 100)

   DATA ((ONE_ARRAY (K, J), K = 1, J-1), J = 1, 100) /4950 * 1.0/
   DATA ((ONE_ARRAY (K, J), K = J, 100), J = 1, 100) /5050 * 0.0/
  END PROGRAM p

gfortran yields the following messages:

  In file snippet.f90:4

   DATA ((ONE_ARRAY (K, J), K = 1, J-1), J = 1, 100) /4950 * 1.0/
                                 1
Error: Variable 'j' at (1) cannot appear in an initialization expression
  In file snippet.f90:5

   DATA ((ONE_ARRAY (K, J), K = J, 100), J = 1, 100) /5050 * 0.0/
                              1
Error: Variable 'j' at (1) cannot appear in an initialization expression


According to the Fortran 95 Draft :

(page 61 )
28 R535 data-implied-do -> ( data-i-do-object-list , data-i-do-variable =
29 scalar-int-expr , scalar-int-expr [ , scalar-int-expr ] )

(page 62)
1 Constraint: A scalar-int-expr of a data-implied-do shall involve as 
primaries only constants,
2 subobjects of constants, or DO variables of the containing 
data-implied-dos, and each
3 operation shall be intrinsic.

Is this a known bug in gfortran ?

Thank you,

-- 
Roger Ferrer Ibáñez
E-mail: rofi@ya.com
E-mail (Casa): roger@rofi.pinchito.com
E-mail (FIB): b4270692@est.fib.upc.edu
E-mail (DAC): rferrer@ac.upc.edu



More information about the Fortran mailing list