Fortran DO, warning use only integer

I installed gfortran on my Ubuntu 15.04 system. When compiling Fortran code, the DO loop only asks for integer parameters, not real values ​​or variables. This includes a loop variable and a step expression. Why can't it take real meaning?

Below is a program taken from here , do 3.5 sections of nested do loops.

        program  xytab
        implicit none
        !constructs a table of z=x/y for values of x from 1 to 2 and 
        !y from 1 to 4 in  steps of .5
        real         ::   x, y, z 
        print *, '           x           y           z'
        do  x = 1,2
            do y = 1,4,0.5
                z = x/y
                print *, x,y,z
            end do
        end  do
        end  program xytab

Error after compilation:

xytab.f95:8.4:

 do y = 1,4,0.5
    1
Warning: Deleted feature: Loop variable at (1) must be integer
xytab.f95:8.12:

 do y = 1,4,0.5
            1
Warning: Deleted feature: Step expression in DO loop at (1) must be integer
xytab.f95:7.3:

do x = 1,2
   1
Warning: Deleted feature: Loop variable at (1) must be integer
+4
source share
1 answer

Fortran , do () () . , ( 0.5). . R818 R819 (8.1.6.2) Fortran 2008. : .

, . Fortran Fortran 95. , Fortran 95 , .

? , , . .

do x=0., 1., 0.1
 ...
end do

? ( Fortran 90) MAX(INT((m2 – m1 + m3) / m3), 0), (m1 - (0.), m2 (1.) m3 (0.1)). 10 11 ( 9)? : , 0.1 , INT . .

,

do y_loop = 0, 6
  y = 1 + y_loop/2.
  ...
end do

y = 1
do
  if (y>4) exit
  ...
  y = y+0.5
end do

, .f90 .f95. gfortran , Fortran 90 ( ). , , -std=legacy. , -std=f95 ( ) .


Fortran 90.

real y
integer i

loop_real: do y=1, 4, 0.5
end do loop_real

loop_integer: do i=1, 4, 0.5
end do loop_integer

loop_real , loop_integer. . INT(0.5) - 0.

+11

All Articles