FIX: FORTRAN 5.0 Loop Optimization, Subroutine, & Array Problem

Last reviewed: September 11, 1997
Article ID: Q59422
5.00 | 5.00 MS-DOS | OS/2 kbtool kbfixlist kbbuglist

The information in this article applies to:

  • Microsoft FORTRAN for MS-DOS, version 5.0
  • Microsoft FORTRAN for OS/2, version 5.0

SYMPTOMS

In FORTRAN version 5.0, the loop optimizer does not correctly optimize the subroutine MOVE in the code below, producing incorrect output.

RESOLUTION

Compiling with /Od or /Odt resolves the problem.

STATUS

Microsoft has confirmed this to be a problem in FORTRAN version 5.0. This problem was corrected in FORTRAN version 5.1.

MORE INFORMATION

Sample Code

      integer*2 buf(20)
      do 10 i=1,10
10 buf(i) = 9

      call move(10,buf(11),buf)

      write(*,'(10(i8))') (buf(i),i=1,20)
      end

      Subroutine move(npts, y1, y2)
      integer*2 y1(*), y2(*)
      do 10 i=1,npts
        y2(i) = y1(i)
10 continue
      return
      end

The following is the correct output:

    0     0     0     0     0     0     0     0     0     0
    0     0     0     0     0     0     0     0     0     0

The following is the incorrect output:

    0     0     0     0 21325 21024 28277 21549 28009  8293
    0     0     0     0     0     0     0     0     0     0


Additional reference words: bad bogus wrong invalid buglist5.00 fixlist5.10
KBCategory: kbtool kbfixlist kbbuglist
KBSubCategory: FLIss
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 11, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.