www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1614] New: sizeof Gives Error When Used Inside an Inline Assembly Block

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

           Summary: sizeof Gives Error When Used Inside an Inline Assembly
                    Block
           Product: D
           Version: 2.007
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: johnkirollos yahoo.com


Statement like "mov ECX,float.sizeof;" is not accepted by the compiler: Error:
"ptr expected".



         ========================================
         void asm_template(T)(T Tval,T* pDest)
         {
                 asm{
                         fld Tval;
                         mov EAX,pDest;




                 }//asm
         }//asm_template

         void main()
         {
           float f1=4.0;
           float f2=5.0;

           asm_template!(float)(f1,&f2);
         }
         ========================================
 Here is the compilation result of the 4 statements marked above:






translated into the value '4'.

Workaround:

    alias float.sizeof FLOAT_SIZE;
    ...
    mov EAX,FLOAT_SIZE;


-- 
Oct 26 2007
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1614


matti.niemenmaa+dbugzilla iki.fi changed:

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





-------


*** This bug has been marked as a duplicate of 1252 ***


-- 
Oct 26 2007