Microsoft KB Archive/39245

From BetaArchive Wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Knowledge Base


BC.EXE "Internal Error" Using Passed Integers in Expression

Article ID: 39245

Article Last Modified on 11/21/2006

This article was previously published under Q39245

SYMPTOMS

An "internal error" is produced when compiling the sample code fragment (below) with BC.EXE. The problem relates to a compiler code-optimization problem in a particular case of passing integer variables as parameters to a subprogram and using them in certain expressions.

STATUS

Microsoft has confirmed this to be a bug in BC.EXE in Microsoft QuickBasic Versions 4.00, 4.00b, and 4.50, and in the Basic Compiler Versions 6.00 and 6.00b for MS-DOS and MS OS/2 (buglist6.00, buglist6.00b). This problem was corrected in Microsoft Basic Professional Development System (PDS) Version 7.00 (fixlist7.00)

To work around this problem, assign a temporary value to one of the integer parameters before doing arithmetic (see below).

MORE INFORMATION

The following code example causes an "internal error":

DECLARE SUB XSCROLL (BarLen%, LCol%, BRow%, Rcol%)
SUB XSCROLL (BarLen%, LCol%, BRow%, Rcol%)
   LCol% = LCol% + 3
   NumCol# = ((Rcol% - LCol%) + 1) \ BarLen%
END SUB
                

The following code example works around the problem:

DECLARE SUB XSCROLL (BarLen%, LCol%, BRow%, Rcol%)
SUB XSCROLL (BarLen%, LCol%, BRow%, Rcol%)
   temp1% = LCol%
   temp1% = temp1% + 3
   LCol% = temp1%
   NumCol# = ((Rcol% - LCol%) + 1) \ BarLen%
END SUB
                


Additional query words: QuickBas BasicCom buglist4.00 buglist4.00b buglist4.50 B_BasicCom

Keywords: KB39245