Menu

#294 OPATTR ignores invalid structure members

generic
open
nobody
None
5
2014-03-25
2013-11-17
qWord
No

The OPATTR operator ignores invalid structure members:

;----------
FOO struct
m1 DWORD ?
m2 DWORD ?
FOO ends
.data
s FOO <>
%echo @CatStr(%opattr s.foo) ; <= should be zero
%echo @CatStr(%opattr FOO.foo) ; OK
%echo @CatStr(%opattr [eax].FOO.foo) ; <= should be zero
;----------

regards, qWord

Discussion

  • japheth

    japheth - 2013-11-23

    jwasm v2.11 emits:
    0
    0
    2

    Hence I don't understand your first "should be zero" comment - obviously it IS zero. Did you use some peculiar cmdline options?

     
  • qWord

    qWord - 2013-11-23

    for the command line "jwasm.exe /c foo.asm", version "v2.11, Oct 20 2013" and "v2.12pre, Nov 4 2013" return:
    768
    0
    2
    MASM (all versions) reutrns zero in all three cases.

    file foo.asm:
    ;--------
    .686
    .model flat, stdcall
    option casemap:none

    FOO struct
    m1 DWORD ?
    m2 DWORD ?
    FOO ends
    .data
    s FOO <>
    %echo @CatStr(%opattr s.foo)
    %echo @CatStr(%opattr FOO.foo)
    %echo @CatStr(%opattr [eax].FOO.foo)
    .code
    main proc
    ret
    main endp
    end main
    ;---------

    See also: http://masm32.com/board/index.php?topic=2597.msg27500#msg27500

    regards, qWord

     
  • japheth

    japheth - 2013-11-24

    Ah yes. I added a simple ".model flat" statement, without a default language, to your sample code, and then OPATTR does indeed return 0 in the first "echo" line.

    I guess this will be fixed in the next version.

     

Log in to post a comment.