digitalmars.D.bugs - optimization of struct argument
- shinichiro.h (29/33) Oct 29 2004 Hi,
- Thomas Kuehne (5/38) Oct 31 2004 added to dstress as:
Hi, When I compile the following code with no optimization, the code works good. But when I compile with optimization, the code works strange. <code> struct S { ubyte a, b, c, d; } int hoge(S s) { printf("%x\n", s); return 0; } int main() { for (int i = 0; i < 1; i++) { S s; s.a = 1; s.b = 2; s.c = 3; s.d = 4; hoge(s); } return 0; } </code> This bug occurs on Windows and Linux. You can reproduce this bug in the following way:dmd d.dgcc d.o -o d -lphobos -lpthread -lm./d4030201dmd -O d.dgcc d.o -o d -lphobos -lpthread -lm./d1
Oct 29 2004
added to dstress as: svn://svn.kuehne.cn/dstress/run/struct_14.d svn://svn.kuehne.cn/dstress/run/struct_15.d Thomas shinichiro.h schrieb:Hi, When I compile the following code with no optimization, the code works good. But when I compile with optimization, the code works strange. <code> struct S { ubyte a, b, c, d; } int hoge(S s) { printf("%x\n", s); return 0; } int main() { for (int i = 0; i < 1; i++) { S s; s.a = 1; s.b = 2; s.c = 3; s.d = 4; hoge(s); } return 0; } </code> This bug occurs on Windows and Linux. You can reproduce this bug in the following way:dmd d.dgcc d.o -o d -lphobos -lpthread -lm./d4030201dmd -O d.dgcc d.o -o d -lphobos -lpthread -lm./d1
Oct 31 2004