www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 697] New: No const folding on asm db,dw, etc

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

           Summary: No const folding on asm db,dw, etc
           Product: D
           Version: 0.177
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: clugdbug yahoo.com.au


This code generates the error message "const init" which doesn't make much
sense.
(The "goto end" is only included to make it safe to run).
The same bug applies also to dd, ds, di, dl, de, df
(and to dw, dq, and dt, which are undocumented).
-------
void main()
{
    goto end;
    const byte z = 35;
    asm { db z; }
    end: ;
}
-------
And it would be nice if 
asm { db 1+2; } 
also worked (it currently prints "end of instruction").


-- 
Dec 18 2006
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=697





------- Comment #1 from thomas-dloop kuehne.cn  2007-01-23 06:05 -------
http://www.digitalmars.com/d/iasm.html
 db, ds, di, dl, df, dd, de
 These pseudo ops are for inserting raw data directly into the code.

The only requirement for inserting something "directly into the code" is for it to be compile time constant. This feature is especially interesting for inserting template generated code. Added to DStress as http://dstress.kuehne.cn/run/a/asm_db_01_A.d http://dstress.kuehne.cn/run/a/asm_db_01_B.d http://dstress.kuehne.cn/run/a/asm_db_01_C.d http://dstress.kuehne.cn/run/a/asm_di_02_A.d http://dstress.kuehne.cn/run/a/asm_di_02_B.d http://dstress.kuehne.cn/run/a/asm_di_02_C.d http://dstress.kuehne.cn/run/a/asm_dl_02_A.d http://dstress.kuehne.cn/run/a/asm_dl_02_B.d http://dstress.kuehne.cn/run/a/asm_dl_02_C.d http://dstress.kuehne.cn/run/a/asm_ds_01_A.d http://dstress.kuehne.cn/run/a/asm_ds_01_B.d http://dstress.kuehne.cn/run/a/asm_ds_01_C.d Thomas --
Jan 23 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=697


smjg iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg iname.com
           Keywords|                            |diagnostic, rejects-valid




------- Comment #2 from smjg iname.com  2007-03-08 15:42 -------
There are two issues here: that this code fails to compile and that the
mysterious message "const init" is in the compiler's repertoire.  If there's
any really invalid code that triggers this error, it needs to be replaced with
something that makes sense.


-- 
Mar 08 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=697





------- Comment #3 from bugzilla digitalmars.com  2007-10-29 00:04 -------
I can fix this particular problem (propagating const values), but generalized
expressions for DB, etc., won't be supported until I get around to replacing
the expression parser in the inline assembler with the full D expression
parser.


-- 
Oct 28 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=697


bugzilla digitalmars.com changed:

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




------- Comment #4 from bugzilla digitalmars.com  2007-11-03 21:42 -------
Fixed dmd 1.023 and 2.007


-- 
Nov 03 2007
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=697


clugdbug yahoo.com.au changed:

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




------- Comment #5 from clugdbug yahoo.com.au  2009-04-15 05:41 -------
I'm reopening this since there are 7 dstress bugs which depend on it.

asm_db_01_C in run/a/asm_db_01_C.d
asm_di_02_A in run/a/asm_di_02_A.d
asm_di_02_C in run/a/asm_di_02_C.d
asm_dl_02_A in run/a/asm_dl_02_A.d
asm_dl_02_C in run/a/asm_dl_02_C.d
asm_ds_01_A in run/a/asm_ds_01_A.d
asm_ds_01_C in run/a/asm_ds_01_C.d


-- 
Apr 15 2009