www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2109] New: asm {lea EAX, [0*0+EAX]; } rejected.

reply d-bugmail puremagic.com writes:

           Summary: asm {lea EAX, [0*0+EAX]; }  rejected.
           Product: D
           Version: 1.028
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: clugdbug yahoo.com.au

It seems there's (correctly) a check for multiplying an index register by 0.
But it is incorrectly rejecting any multiply of a constant by 0.

    asm {lea EAX, [0*4+EAX]; } // fails ("bad operand").
    asm {lea EAX, [4*0+EAX]; } // fails ("bad operand").
    asm {lea EAX, [EAX+4*0]; } // fails ("bad operand").
    asm {lea EAX, [0+EAX]; } // OK
    asm {lea EAX, [7*7+EAX]; } // OK

Only known workaround is to replace 0*X with 0.
This is painful in autogenerated code

May 14 2008
parent d-bugmail puremagic.com writes:

bugzilla digitalmars.com changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

------- Comment #1 from bugzilla digitalmars.com  2008-05-22 05:07 -------
Fixed dmd 2.014

May 22 2008