www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1836] New: Inline assembler can't use enum values as parameters.

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1836

           Summary: Inline assembler can't use enum values as parameters.
           Product: D
           Version: 1.026
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: burton-radons shaw.ca


The inline assembler rejects any attempt to use an enum value as a parameter:

        enum
        {
                enumeration = 1,
        }

        void test ()
        {
                asm
                {
                        mov EAX, enumeration;
                }
        }

This code fails compilation with "bad type/size of operands 'enumeration'",
regardless of whether enum is given a type or if AX or AH is attempted instead.
It should be equivalent to "mov EAX, 1;".

The workaround is to assign the enumeration value to a const value before the
asm statement.


-- 
Feb 14 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1836






Added to DStress as
http://dstress.kuehne.cn/run/e/enum_53_A.d
http://dstress.kuehne.cn/run/e/enum_53_B.d
http://dstress.kuehne.cn/run/e/enum_53_C.d
http://dstress.kuehne.cn/run/e/enum_53_D.d


-- 
Feb 25 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1836






Did you intend for B-D to succeed in the current compiler, Thomas? Because you
assign "const dummy = enumeration;" in them but you continue to use
"enumeration" in the asm code.


-- 
Feb 25 2008
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1836


bugzilla digitalmars.com changed:

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





Fixed dmd 1.028 and 2.012


-- 
Mar 06 2008