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

Thomas Kuehne thomas-dloop at kuehne.cn
Sat Nov 25 10:02:40 PST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail at 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 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

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-----



More information about the D.gnu mailing list