News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Guaranteed to crash in MASM (unless you are using MASM 6.xx)

Started by aw27, December 04, 2017, 01:20:10 AM

Previous topic - Next topic

aw27

This will crash in recent releases of MASM. Builds fine in MASM 6.xxx
SDWORD appears to be the culprit



.686
.MODEL FLAT, STDCALL

.data
myVar SDWORD ?

.code

main PROC
int 3 ; <- Remove to run on the command line

mov eax, 3
.IF SDWORD PTR eax > 0
.IF eax==3
lea eax, [eax+2*eax]
mov ecx, 3
mov SDWORD PTR myVar, ecx
.ENDIF
.ENDIF

ret
main ENDP

END main


or this:


.686
.MODEL FLAT, STDCALL

.data
myVar SDWORD ?


.code

main PROC
int 3 ; <- Remove to run on the command line

        mov myVar, 3
.IF SDWORD PTR myVar > 0
.IF myVar==3
lea eax, [eax+2*eax]
mov ecx, 3
mov SDWORD PTR myVar, ecx
.ENDIF
.ENDIF

ret
main ENDP

END main

nidud

deleted

jj2007

Looks similar to the MASM 14.0 .if signed comparison bug thread.

The SDWORD ptr doesn't work e.g. in ML 14 and 15, the jmp is one byte off. It works fine in ML 6.14 ... 10.0, though. It seems M$ has recently lost control over their pile of s**t.

Workaround:
         mov SDWORD PTR myVar, ecx
         nop

Rumours say there is also a perfect clone for ML that handles all recent opcodes perfectly, is three times faster and absolutely bug-free, at least compared to recent M$ assemblers 8)

aw27

I was not aware of the need for the nop   :(

So, now everybody knows that the bug is still on the latest and greatest:
Microsoft (R) Macro Assembler Version 14.11.25547.0
Copyright (C) Microsoft Corporation.  All rights reserved.

nidud

deleted

jj2007

Quote from: aw27 on December 04, 2017, 02:15:27 AM
I was not aware of the need for the nop   :(

Contact Hyde, Irvine, Kusswurm and Iczelion - they must update their books and tutorials 8)

(hint: UAsm works without the magic nop)

nidud

deleted

aw27

Quote from: nidud on December 04, 2017, 02:57:09 AM
Re: MASM 14.0 .if signed comparison bug

Quote from: aw27 on August 06, 2017, 03:08:43 PM
Quote from: Queue on August 05, 2017, 08:19:07 PM
Quote from: LiaoMi on August 05, 2017, 06:03:40 PM
did you report this discovery to Microsoft?
No, I haven't. I don't even know where I could report this sort of information to Microsoft.
You can try https://connect.microsoft.com/VisualStudio/

LOL  :icon_eek:

aw27

And the case of the mysterious disappearance of "dec ebx" (yes, NOP shall fix).


.686
.MODEL FLAT, STDCALL

.data
myValue SDWORD 10


.code

main PROC
int 3 ; <- Remove to run on the command line

mov edx, 3
mov ebx, edx
.WHILE ebx>0
.WHILE ecx<myValue
inc ecx
.ENDW
dec ebx ; <-- will disappear
.ENDW

ret
main ENDP

END main

jj2007

Quote from: aw27 on December 04, 2017, 03:21:57 AMAnd the case of the mysterious disappearance of "dec ebx" (yes, NOP shall fix).
We shouldn't be too critical, José. At least, with the extra nop, this is one of the last Micros**t assemblers who understand the .While ... .Endw syntax :t

aw27

Quote from: jj2007 on December 04, 2017, 03:28:29 AM
Quote from: aw27 on December 04, 2017, 03:21:57 AMAnd the case of the mysterious disappearance of "dec ebx" (yes, NOP shall fix).
We shouldn't be too critical, José. At least, with the extra nop, this is one of the last Micros**t assemblers who understand the .While ... .Endw syntax :t

Let's enjoy it while it lasts then.  :biggrin:

hutch--

 :biggrin:

Real Men[tm] code in mnemonics, if you need lots of high level hand holding, try a visual garbage generator.  :P

jj2007

Quote from: hutch-- on December 04, 2017, 09:47:55 AMReal Men[tm] code in mnemonics

Quote from: aw27 on December 04, 2017, 03:21:57 AM
      dec ebx ; <-- will disappear

The dec ebx is a mnemonic. For recent MASM versions, you need to resort to the level below mnemonics:db 4bh ; dec ebx

For Real MenTM, the db nnn notation should be made obligatory 8)

HSE

Quote from: jj2007 on December 04, 2017, 10:29:30 AM
For Real MenTM, the db nnn notation should be made obligatory 8)
You have tried to say "Real Crazy MenTM"?  :biggrin:
Equations in Assembly: SmplMath