FIX: Duplicate Lines Incorrectly Removed by Optimizer

ID: Q74898


The information in this article applies to:
  • Microsoft FORTRAN for MS-DOS, versions 5.0, 5.1
  • Microsoft FORTRAN for OS/2, versions 5.0, 5.1


SYMPTOMS

The sample code below produces correct output when optimization is disabled, but not with default optimization. The optimizer incorrectly removes the two lines noted below.

The expected output is:


   100         1         244           8 
The output with default optimization is:

   0           0         244           8 


STATUS

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


MORE INFORMATION

The following code can be used to demonstrate the problem.

Sample Code


        INTEGER*2 IBBYTE(2),MINVAL,MAXVAL,IVAL
       CHARACTER*1 CBYTE(4)

       MINVAL=100
       MAXVAL=100
       MINVAL=MIN(MINVAL,500)
       MAXVAL=MAX(MAXVAL,500)
       IBBYTE(1)=MOD(REAL(MINVAL),256.0)  !this line is optimized out
       IBBYTE(2)=MINVAL/56                !this line is optimized out
       CBYTE(1)=CHAR(IBBYTE(1))
       CBYTE(2)=CHAR(IBBYTE(2))
       IBBYTE(1)=MOD(REAL(MAXVAL),256.0)
       IBBYTE(2)=MAXVAL/56
       CBYTE(3)=CHAR(IBBYTE(1))
       CBYTE(4)=CHAR(IBBYTE(2))
       WRITE(*,*) (ICHAR(CBYTE(N)),N=1,4)
       STOP
       END 

Additional query words: 5.00 5.10 buglist5.00 buglist5.10 fixlist1.00

Keywords :
Version : :5.0,5.1
Platform :
Issue type :


Last Reviewed: November 2, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.