Microsoft KB Archive/77837

= BC.EXE &quot;Internal Error&quot; using SGN Function on Parameter in SUB =

Article ID: 77837

Article Last Modified on 10/20/2003

-

APPLIES TO


 * Microsoft BASIC Professional Development System 7.0
 * Microsoft BASIC Professional Development System 7.1

-



This article was previously published under Q77837



SYMPTOMS
The following compiler error

BC : internal error near xxxx

can occur when the SGN(x) function is used in a SUB with an equation that uses a passed integer variable. This problem does not occur in the QBX.EXE environment, or in versions earlier than 7.0 of the BC.EXE compiler that is included with Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2.



STATUS
Microsoft has confirmed this to be a bug with Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2, versions 7.0 and 7.1. This problem was corrected in Microsoft Visual Basic version 1.0 for MS-DOS.



Code to Reproduce Problem
DECLARE SUB Test (I%)

SUB Test (I%) FOR I% = 1 to 2 C = SGN(B) * I%     NEXT I%   END SUB To compile the program, type the following at the DOS prompt:

BC TEST;

The error message &quot;BC : internal error near xxxx&quot; results. To avoid this error, use one of the following workarounds:


 * Compile with /X (this inhibits compiler optimization, and affects how the code is generated).
 * Reverse SGN(B) and I% in the equation C = SGN(B) * I%
 * Change the passed parameter to any type other than integer.
 * Avoid using the passed integer(s) in the equation.
 * Instead of using I% as the passed variable, use I along with DEFINT A-Z to cause the default type to be INTEGER.

Note the following:


 * Compiling with BC /D does not correct the problem.
 * The passed variable must be explicitly declared as an integer to cause the problem; DEFINT A-Z will not cause a problem.
 * The error occurs using any math operator in the equation (for example, C = SGN(B) + I% will yield the same error message.)

Additional query words: VBmsdos BasicCom 7.10 7.00 b_vbmsdos 1.00 buglist7.00 buglist7.10 fixlist1.00

Keywords: KB77837

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.