FIX: "Integer divide by 0" Error HandlingLast reviewed: September 18, 1997Article ID: Q118337 |
1.00 1.00a | 1.00
MS-DOS | WINDOWS NTkbtool kbfixlist kberrmsg The information in this article applies to:
SYMPTOMSIn code, there are two significant problems with dividing by 0:
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This problem was corrected in Microsoft FORTRAN PowerStation 32, version 4.0.
MORE INFORMATIONTo generate the "Integer divide by 0" exceptions, compile and run the "Sample Code 1," below. With optimization off, the exception occurs on the first print statement. With optimization on, it occurs on the second print statement. NOTE: FORTRAN PowerStation for MS-DOS, version 1.0, correctly generates error F6003 in this case. To produce the invalid code generation and warning F4723, compile and run either sample with optimization on (option /Ox). To demonstrate invalid code generation with no warnings or errors, compile and run "Sample Code 2," below, with optimization on and warnings off (/Ox /W0). With optimization off (default option), "Sample Code 2" will correctly generate the run-time error for "Integer divide by 0": M6103. NOTE: /4Yb ($DEBUG) does not produce any additional error messages.
Sample Code 1c compile options needed: See text above.
integer i,j character*4 c /"0"/ i=0 j=1 print *, ' 1/0 =',j/i read(c,'(I1)') i print *, ' 1/0 =',j/i end Sample Code 2c compile options needed: See text above.
real a,b a=0 b=1 print *, ' 1.0/0.0 =',b/a end |
Additional reference words: 1.00 1.00a
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |