FIX: JMP Jumps to the Proc When Using Duplicate Names

Last reviewed: September 16, 1997
Article ID: Q76911
6.00 6.00a 6.00b | 6.00 6.00a 6.00b
MS-DOS           | OS/2
kbtool kbfixlist kbbuglist

The information in this article applies to:

  • Microsoft Macro Assembler for MS-DOS, versions 6.0, 6.0a, and 6.0b
  • Microsoft Macro Assembler for OS/2, versions 6.0, 6.0a, and 6.0b

SYMPTOMS

Using the Microsoft Macro Assembler (MASM) versions 6.0, 6.0a or 6.0b, the JMP instruction will jump to the procedure name rather than a local label if the names of the procedure and the local label are identical. After the jump, the procedure begins running rather than the code at the label.

RESOLUTION

To work around the problem, create a local label with a name that is different from the procedure name.

STATUS

Microsoft has confirmed this to be a problem in MASM versions 6.0, 6.0a, and 6.0b. This problem was corrected in MASM for MS-DOS version 6.1.

MORE INFORMATION

The sample code below does not generate a syntax error for the identical procedure name and label name because the label is local to the procedure it is defined in. If the label is defined with a double colon (::) instead of a single colon (:), it becomes a global label and causes the assembler to generate an error. The assembler should generate code that jumps to the local label rather than the procedure.

Sample Code

; Assemble options needed: none

.MODEL small .STACK 4096

.DATA

.CODE

   .startup
   call myproc
   .exit 0

myproc PROC
   jmp SHORT mylabel
mylabel:
   ret  ; Should execute this
myproc ENDP

mylabel PROC

   ret  ; Shouldn't execute this
mylabel ENDP

END


Additional reference words: 6.00 6.00a 6.00b buglist6.00 buglist6.00a
buglist6.00b fixlist6.10
KBCategory: kbtool kbfixlist kbbuglist
KBSubCategory: MLIss
Solution Type : kbfix


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 16, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.