News:

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

Main Menu

Possible MASM 8.0 bug

Started by KeepingRealBusy, October 22, 2013, 10:59:53 AM

Previous topic - Next topic

KeepingRealBusy

I just ran into a possible MASM bug, at least I think it should have given me an error or warning instead of assembling:


Bad: "mov    [esi(x*oPointerSize)],ecx" should be "mov    [esi+(x*oPointerSize)],ecx",
no error detected by MASM 8.0 and it assembled correctly (in 5 places).

000027DD  8B 35 00000090 R   C     mov    esi,pDataInBuffer
000027E3  8B 1D 0000002C R   C     mov    ebx,pTypeSizes
000027E9  8B C6       C     mov    eax,esi
000027EB  B9 00000018       C     mov    ecx,(6*oPointerSize)
000027F0  89 0E       C     mov    [esi(0*oPointerSize)],ecx
000027F2  8D 04 01       C     lea    eax,[eax+ecx]
000027F5  A3 00000060 R      C     mov    pQuarter0,eax
000027FA  8B 0B       C     mov    ecx,[ebx+(0*oPointerSize)]
000027FC  89 4E 04       C     mov    [esi(1*oPointerSize)],ecx
000027FF  8D 04 01       C     lea    eax,[eax+ecx]
00002802  A3 00000064 R      C     mov    pQuarter1,eax
00002807  8B 4B 04       C     mov    ecx,[ebx+(1*oPointerSize)]
0000280A  89 4E 08       C     mov    [esi(2*oPointerSize)],ecx
0000280D  8D 04 01       C     lea    eax,[eax+ecx]
00002810  A3 00000068 R      C     mov    pQuarter2,eax
00002815  8B 4B 08       C     mov    ecx,[ebx+(2*oPointerSize)]
00002818  89 4E 0C       C     mov    [esi(3*oPointerSize)],ecx
0000281B  8D 04 01       C     lea    eax,[eax+ecx]
0000281E  A3 0000006C R      C     mov    pQuarter3,eax
00002823  8B 4B 0C       C     mov    ecx,[ebx+(3*oPointerSize)]
00002826  89 4E 10       C     mov    [esi(4*oPointerSize)],ecx
00002829  8D 04 01       C     lea    eax,[eax+ecx]
0000282C  A3 00000070 R      C     mov    pQuarter4,eax
00002831  C7 46 14       C     mov    DWORD PTR [esi(5*oPointerSize)],0
   00000000

Good: corrections made, assembled correctly with no errors (in 5 places)

000027DD  8B 35 00000090 R   C     mov    esi,pDataInBuffer
000027E3  8B 1D 0000002C R   C     mov    ebx,pTypeSizes
000027E9  8B C6       C     mov    eax,esi
000027EB  B9 00000018       C     mov    ecx,(6*oPointerSize)
000027F0  89 0E       C     mov    [esi+(0*oPointerSize)],ecx
000027F2  8D 04 01       C     lea    eax,[eax+ecx]
000027F5  A3 00000060 R      C     mov    pQuarter0,eax
000027FA  8B 0B       C     mov    ecx,[ebx+(0*oPointerSize)]
000027FC  89 4E 04       C     mov    [esi+(1*oPointerSize)],ecx
000027FF  8D 04 01       C     lea    eax,[eax+ecx]
00002802  A3 00000064 R      C     mov    pQuarter1,eax
00002807  8B 4B 04       C     mov    ecx,[ebx+(1*oPointerSize)]
0000280A  89 4E 08       C     mov    [esi+(2*oPointerSize)],ecx
0000280D  8D 04 01       C     lea    eax,[eax+ecx]
00002810  A3 00000068 R      C     mov    pQuarter2,eax
00002815  8B 4B 08       C     mov    ecx,[ebx+(2*oPointerSize)]
00002818  89 4E 0C       C     mov    [esi+(3*oPointerSize)],ecx
0000281B  8D 04 01       C     lea    eax,[eax+ecx]
0000281E  A3 0000006C R      C     mov    pQuarter3,eax
00002823  8B 4B 0C       C     mov    ecx,[ebx+(3*oPointerSize)]
00002826  89 4E 10       C     mov    [esi+(4*oPointerSize)],ecx
00002829  8D 04 01       C     lea    eax,[eax+ecx]
0000282C  A3 00000070 R      C     mov    pQuarter4,eax
00002831  C7 46 14       C     mov    DWORD PTR [esi+(5*oPointerSize)],0
   00000000


Have not tried this with MASM 6.15 or MASM 9.0 or JWASM.

Dave.

dedndave

i think that's a valid form
the plus is implied

a similar example
SomeLabel[ebx]

MichaelW

What are x and oPointerSize?

Assembling this with 6.15:

    oPointerSize = 4
    x = 4
    mov [esi(x*oPointerSize)],ecx


I get:

00401000 894E 10 MOV DWORD PTR DS:[ESI+10],ECX

Well Microsoft, here's another nice mess you've gotten us into.

KeepingRealBusy

Michael,

Your assumptions are correct. I have an array of structures with 4 pointers - the Buffer Pointer, the Build Pointer, the End Buffer pointer, and a pointer to another array with 4 size values for the sizes of the 4 sections of the data in the buffer. There are 256 structures for the 256 buffers being filled,

The code works correctly, I was just supprised that this was not flagged. I was not aware of the "default" Plus. MASM certainly does not assume a missing ']' or ')' at the end of a line and flags that as well as other illegal register usages in base, index, offset form.

Dave.

hutch--

Dave,

Just use a later version, from memory 8.0 was a bit buggy here and there as it looked like a recent rewrite.

Tedd

This is just another accepted syntax form.
It's not a bug, it's a feature :badgrin:
Potato2