Microsoft KB Archive/69979

MOD Intrinsic Function Syntax Error Causes Print Screens PSS ID Number: Q69979 Article last modified on 04-08-1993

4.01 4.00 4.10 5.00 | 4.10 5.00

MS-DOS | OS/2

Summary:

In FORTRAN version 4.10 or 5.00, a protection violation can be generated under OS/2 during the first pass of the compiler when the program being compiled contains a complicated expression that includes the MOD intrinsic function with an incorrect number of arguments.

With FORTRAN versions 4.00, 4.01, 4.10, and 5.00, compiling this same code under DOS can cause the machine to continuously generate print screens, requiring you to perform a warm boot to escape. If the machine is not connected to a printer at LPT1, it will appear as if the compiler is hung.

The code should generate the following error:

F2503: MOD: incorrect use of intrinsic function

Microsoft has confirmed this to be a problem in Microsoft FORTRAN versions 4.x and 5.00 for MS-DOS and versions 4.10 and 5.00 for OS/2. This problem was corrected in Microsoft FORTRAN version 5.10.

More Information:

The following code reproduces the problem:

dimension b(1,1),c(1) a = c(1) * b(1,1) + c(1)* b(1,1) + +    c(mod(i+1)) *                        ! too few arguments in MOD ! function +    b(mod(e+i+d,1),mod(d,1)) + +    c(mod(i,1)) * +    b(mod(e+i+d,1),mod(d,1)) end Reducing the complexity of the expression for “a” will result in the correct error being generated. The code below produces the error:

F2503: MOD: incorrect use of intrinsic function.

dimension b(1,1),c(1) a = c(1) * b(1,1) + c(1)* b(1,1) + +    c(mod(i+1)) *                        ! too few arguments in MOD ! function +    b(mod(e+i+d,1),mod(d,1)) + +    c(mod(i,1)) ! removed one line end Additional Reference Words: hang hangs print screen

=
================================================================

Copyright Microsoft Corporation 1993.