FIX: Unexpected Statement Reached with Loop Optimization (75624)



The information in this article applies to:

  • Microsoft FORTRAN Compiler for MS-DOS 5.0
  • Microsoft FORTRAN Compiler for MS-DOS 5.1
  • Microsoft FORTRAN compiler for OS/2 5.0
  • Microsoft FORTRAN compiler for OS/2 5.1

This article was previously published under Q75624

SYMPTOMS

Program execution incorrectly reaches executable statements when loop optimization is enabled.

STATUS

Microsoft has confirmed this to be a problem in the products listed above. The problem was corrected in FORTRAN PowerStation, version 1.0.

MORE INFORMATION

In the following program, line number 116 is executed, when it should never be reached:

Sample code

      I  INTEGER*2 LOOP/5/ 

      WRITE (*,'(1x,I4)') LOOP

110   IF (LOOP .LE. 0) GOTO 120

C     WRITE (*,'(1x,I4)') LOOP
      LOOP = LOOP - 1
      GOTO 110

116   write (*,'(1x,A,I4)') 'Beyond loop',loop

120   write (*,'(1x,I4)') loop
      end
				

RESOLUTION

To alleviate this problem, suppress loop optimization with the /Od or /Odct compiler options.

Modification Type:MajorLast Reviewed:12/1/2003
Keywords:kbfix KB75624