Thread overview
[Issue 578] New: GDC evaluates rvalue of array assignment repeatedly
Nov 20, 2006
d-bugmail
Nov 25, 2006
Thomas Kuehne
Nov 25, 2006
d-bugmail
Dec 17, 2006
d-bugmail
Dec 17, 2006
d-bugmail
November 20, 2006
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


-- 

November 25, 2006
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


November 25, 2006
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




------- Comment #2 from braddr@puremagic.com  2006-11-25 15:08 -------
Mass reassignment of gdc bugs from me to David.


-- 

December 17, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=578


dvdfrdmn@users.sf.net changed:

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




-- 

December 17, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=578


dvdfrdmn@users.sf.net changed:

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




------- Comment #3 from dvdfrdmn@users.sf.net  2006-12-16 21:23 -------
Fixed in GDC 0.20


--