FIX: Intrinsic Functions in Substring Evaluation FailLast reviewed: September 11, 1997Article ID: Q43068 |
4.00 4.01 4.10 5.00 5.10 | 4.10 5.00 5.10
MS-DOS | OS/2kbtool kbfixlist kbbuglist kberrmsg The information in this article applies to:
SYMPTOMSAn application developed in Microsoft FORTRAN that uses a complicated expression that involves intrinsic functions to calculate substring indexes generates incorrect results.
RESOLUTIONSimplify the expression used to specify the substring index by using one or more temporary variables to store intermediate results of the computation.
STATUSMicrosoft has confirmed this to be a problem in FORTRAN versions 4.0, 4.01, 4.1, 5.0 and 5.1 for MS-DOS and versions 4.1, 5.0, and 5.1 for OS/2. This problem was corrected in FORTRAN PowerStation.
MORE INFORMATIONThe following program writes the string "B" to the display instead of the correct string "BCDEF."
Sample CodeC Compiler options required: None
CHARACTER *20 A, B B = 'ABCDEFGHIJKLMNOP' I = 2 J = 6 A = B(I:(I + IDIM(J, 2))) WRITE(*,*) A ENDThe following code demonstrates one solution to the problem.
Sample CodeC Compiler options required: None
PROGRAM STRING CHARACTER *20 A, B B='ABCDEFGHIJKLMNOP' I = 2 J = 6 K = I + IDIM(J, 2) A = B(I:K) WRITE(*,*) A END |
Additional reference words: 4.00 4.01 4.10 5.00 5.10
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |