[Nasm-bugs] [Bug 3392450] New: Zero offsets are not handled correctly by the optimizer.

no-reply at bugzilla-nasm.gorcunov.org no-reply at bugzilla-nasm.gorcunov.org
Fri Nov 17 12:28:36 PST 2017


https://bugzilla.nasm.us/show_bug.cgi?id=3392450

            Bug ID: 3392450
           Summary: Zero offsets are not handled correctly by the
                    optimizer.
           Product: NASM
           Version: 2.12.xx
          Hardware: All
                OS: All
            Status: OPEN
          Severity: normal
          Priority: Medium
         Component: Assembler
          Assignee: nobody at nasm.us
          Reporter: krille_n_ at hotmail.com
                CC: gorcunov at gmail.com, hpa at zytor.com, nasm-bugs at nasm.us
     Obtained from: Binary from nasm.us

Output from nasm -v;
NASM version 2.12.02rc9 compiled on Jun 16 2016

I haven't tried a newer version (I'm lazy).

Example code;
----8<----
LabelWithZeroOffset:

        mov     ax, [bx+0]
        mov     bx, [si+0]
        mov     cx, [di+0]

        mov     ax, [bx+LabelWithZeroOffset]
        mov     bx, [si+LabelWithZeroOffset]
        mov     cx, [di+LabelWithZeroOffset]
----8<----

The code generated from this looks like this in DEBUG;

150C:0100 8B07          MOV     AX,[BX]
150C:0102 8B1C          MOV     BX,[SI]
150C:0104 8B0D          MOV     CX,[DI]
150C:0106 8B870000      MOV     AX,[BX+0000]
150C:010A 8B9C0000      MOV     BX,[SI+0000]
150C:010E 8B8D0000      MOV     CX,[DI+0000]

As you can see, the first three instructions have the +0 optimized away (even
when using -O0 or STRICT, which is probably a bug in itself) so I would expect
the same result from the last three instructions. Using -Ox makes no
difference.

Thanks for your great work!

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are watching all bug changes.


More information about the Nasm-bugs mailing list