www.digitalmars.com         C & C++   DMDScript  

D.gnu - [Issue 578] New: GDC evaluates rvalue of array assignment repeatedly

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

           Summary: GDC evaluates rvalue of array assignment repeatedly
           Product: GDC
           Version: 0.19
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: glue layer
        AssignedTo: braddr puremagic.com
        ReportedBy: akaquinn hotmail.com


In array assignments of a scalar into an array (ie emulating memset), the
expression is evaluated repeatedly.  It is NOT evaluated repeatedly in DMD.

This error appears to exist in every version of GDC (0.19, latest 0.20 from
SVN, latest trunk from SVN)

Reproduction:

Script started on Sun 19 Nov 2006 05:36:34 PM PST
[gregor glapgor test]$ cat test.d
extern (C) int printf(char *, ...);

int main()
{
    int[10] a;
    a[] = printf("Ha-HAH\n");
    return 0;
}

[gregor glapgor test]$ gdc test.d
[gregor glapgor test]$ ./a.out
Ha-HAH
Ha-HAH
Ha-HAH
Ha-HAH
Ha-HAH
Ha-HAH
Ha-HAH
Ha-HAH
Ha-HAH
Ha-HAH
[gregor glapgor test]$ exit
exit

Script done on Sun 19 Nov 2006 05:36:42 PM PST


-- 
Nov 19 2006
next sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail puremagic.com schrieb am 2006-11-20:
 http://d.puremagic.com/issues/show_bug.cgi?id=578
 In array assignments of a scalar into an array (ie emulating memset), the
 expression is evaluated repeatedly.  It is NOT evaluated repeatedly in DMD.

 This error appears to exist in every version of GDC (0.19, latest 0.20 from
 SVN, latest trunk from SVN)

 Reproduction:

 Script started on Sun 19 Nov 2006 05:36:34 PM PST
 [gregor glapgor test]$ cat test.d
 extern (C) int printf(char *, ...);

 int main()
 {
     int[10] a;
     a[] = printf("Ha-HAH\n");
     return 0;
 }

 [gregor glapgor test]$ gdc test.d
 [gregor glapgor test]$ ./a.out
 Ha-HAH
 Ha-HAH
 Ha-HAH
 Ha-HAH
 Ha-HAH
 Ha-HAH
 Ha-HAH
 Ha-HAH
 Ha-HAH
 Ha-HAH
 [gregor glapgor test]$ exit
 exit

 Script done on Sun 19 Nov 2006 05:36:42 PM PST
Added to DStress as http://dstress.kuehne.cn/run/o/opSliceAssign_03_A.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFaH0OLK5blCcjpWoRAgb0AKCWUy7kuVK82gTg08nWkx+TDDPceACfaHLZ J9zICH1VU9on6PrL74WyJM4= =1ff3 -----END PGP SIGNATURE-----
Nov 25 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=578


braddr puremagic.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|braddr puremagic.com        |dvdfrdmn users.sf.net





Mass reassignment of gdc bugs from me to David.


-- 
Nov 25 2006
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=578


dvdfrdmn users.sf.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED




-- 
Dec 16 2006
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=578


dvdfrdmn users.sf.net changed:

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





Fixed in GDC 0.20


-- 
Dec 16 2006