"attempt to modify loop index" check in

Luca BOTTURA Luca.Bottura@cern.ch
Tue Jul 28 02:04:00 GMT 1998


Hallo ! A bug in egcs ? The following code:

integer i
real a(4)
do i=1,3
   write(6,*) (a(i),i=1,4)
enddo
end

compiles and executes without any error message, in spite of a modification 
of the loop index i inside the implicit loop of the write statement.

Funny enough, the loop executes the correct number of times, in spite of the 
fact that the value of i is continuously  toggled between 5 (end value of 
the implicit loop in the write statement) and 6 (after passing the index 
increment)

Finally, the same code would not compile if instead of a "write", one would 
use a "read".

Luca




More information about the Gcc-bugs mailing list