BC.EXE "Math Overflow" May Flag Incorrect Line of Code (72600)






This article was previously published under Q72600

SYMPTOMS

When BC.EXE gives a "Math Overflow" error message at compile time, it may flag the incorrect line of source code.

STATUS

Microsoft has confirmed this to be a bug in the BC.EXE compiler provided with Microsoft QuickBasic version 4.5 for MS-DOS (buglist4.50), and with Microsoft Basic Professional Development System (PDS) versions 7.0 and 7.1 for MS-DOS and MS OS/2 (buglist7.00, buglist7.10). We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The workaround is to locate the nearest upwards line where the compile-time "Math Overflow" is most likely to have occurred. In the example below, 32768 exceeds the allowed limits for the integer variable MaxBuff% (which can range from -32768 to +32767). [You can correct the programming error by changing MaxBuff% to a long integer, MaxBuff&, which can range from -2,147,483,648 to +2,147,483,647.]

When the following code is compiled with BC.EXE from QuickBasic 4.5 or from Basic PDS 7.0 or 7.1, a "Math Overflow" error message properly occurs, but the compiler indicates the error on the variable BuffCount& rather than the correct variable MaxBuff%.
   MaxBuff% = 32768
   FOR i& = 1& TO BuffCount&
   NEXT
   END
				

Modification Type: Minor Last Reviewed: 1/8/2003
Keywords: KB72600