BUG: Internal Error for SWAP of TYPE Elements in SUB Using VAL (80412)



The information in this article applies to:

  • Microsoft Visual Basic for MS-DOS
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.0
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.1

This article was previously published under Q80412

SYMPTOMS

An "Internal Error" 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.

MORE INFORMATION

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("1")
   Z.CCC = VAL("1")
   SWAP Z.BBB, Z.CCC
END SUB
				

Modification Type:MinorLast Reviewed:8/16/2005
Keywords:kbbug KB80412