G
glen herrmannsfeldt
(snip, I wrote)
According to the Fortran 66 standard (changed in Fortran 77) the DO
variable is undefined on normal end of the loop. If you GOTO, or
otherwise exit the loop, then it is defined.
In this case, it is usual for good compilers to keep I in a register
and never store it in the actual I.
As with C undefined behavior, standard conforming programs aren't
allowed to test it, but 5 and 11 are the usual possibilities.
When kept in a register, it might increment by the appropriate
byte increment, so no actual value to store.
Yes, it was to note that the way compilers see code isn't always
the way humans do.
-- glen
I am sorry, but I am not familiar enough with Fortran 66 to determine
that with any certainty.
My initial guess would be 10, but I would not be surprised if it should
be 5 or 11.
And if it is about the value in the register, I would have no problems
with that being 20, 40, or even 0.
According to the Fortran 66 standard (changed in Fortran 77) the DO
variable is undefined on normal end of the loop. If you GOTO, or
otherwise exit the loop, then it is defined.
In this case, it is usual for good compilers to keep I in a register
and never store it in the actual I.
As with C undefined behavior, standard conforming programs aren't
allowed to test it, but 5 and 11 are the usual possibilities.
When kept in a register, it might increment by the appropriate
byte increment, so no actual value to store.
But I don't see what that has to do with what a optimizer can
do with two semantically equivalent pieces of code written
in different styles.
Yes, it was to note that the way compilers see code isn't always
the way humans do.
-- glen