[Issue 578] New: GDC evaluates rvalue of array assignment repeatedly

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Nov 19 17:35:32 PST 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 at puremagic.com
        ReportedBy: akaquinn at 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 at glapgor test]$ cat test.d
extern (C) int printf(char *, ...);

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

[gregor at glapgor test]$ gdc test.d
[gregor at 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 at glapgor test]$ exit
exit

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


-- 




More information about the D.gnu mailing list