Microsoft KB Archive/80412

= BUG: Internal Error for SWAP of TYPE Elements in SUB Using VAL =

Article ID: 80412

Article Last Modified on 8/16/2005

-

APPLIES TO


 * Microsoft Visual Basic for MS-DOS
 * Microsoft BASIC Professional Development System 7.0
 * Microsoft BASIC Professional Development System 7.1

-



This article was previously published under Q80412



SYMPTOMS
An &quot;Internal Error&quot; message may occur at compile time if you use the SWAP statement to swap two elements of a user-defined TYPE statement in a SUB program where the VAL function is used to assign values to the elements of the TYPE.



WORKAROUND
All of the following are workarounds to this problem:


 * Compile with the BC /X option. The /X option normally indicates the presence of RESUME statements in the code, and inhibits some compiler optimizations.
 * Avoid using the SWAP statement.
 * Assign the results of the VAL function to a temporary variable before assigning a value to the TYPE element.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.



Code to Reproduce Error
TYPE X  AAA AS LONG BBB AS SINGLE CCC AS SINGLE END TYPE

SUB TEST (Z AS X)  Z.BBB = VAL(&quot;1&quot;) Z.CCC = VAL(&quot;1&quot;) SWAP Z.BBB, Z.CCC END SUB

Additional query words: VBmsdos buglist1.00 buglist7.00 buglist7.10 1.00 7.00 7.10

Keywords: kbbug KB80412

-

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

© Microsoft Corporation. All rights reserved.