digitalmars.D.bugs - compiler optimization bug
- Tiago Gasiba (28/28) Nov 24 2005 The following code works fine without the -O option (with DMD 0.139 on L...
- Tiago Gasiba (6/43) Nov 25 2005 Same happens with DMD 0.140 on Linux.
- Thomas Kuehne (13/38) Nov 26 2005 -----BEGIN PGP SIGNED MESSAGE-----
The following code works fine without the -O option (with DMD 0.139 on Linux) but goes crazy with -O: import std.string; /* Different results compiling with "dmd bug.d" 1+0i 0+1i 1+1i 1+-1i 1+1i 2+0i compiling with "dmd -O bug.d" 1+0i 0+1i 1+1i 0+0i 0+0i 0+0i */ int main( ){ static cdouble[] A = [1, 1i, 1+1i]; int ii; foreach( cdouble z; A ) printf("%.*s ",toString(z)); printf("\n"); for( ii=0; ii<A.length; ii++ ) A[ii] += -1i*A[ii]; foreach( cdouble z; A ) printf("%.*s ",toString(z)); printf("\n"); return 0; } Tiago -- Tiago Gasiba (M.Sc.) - http://www.gasiba.de Everything should be made as simple as possible, but not simpler.
Nov 24 2005
Tiago Gasiba schrieb:The following code works fine without the -O option (with DMD 0.139 on Linux) but goes crazy with -O: import std.string; /* Different results compiling with "dmd bug.d" 1+0i 0+1i 1+1i 1+-1i 1+1i 2+0i compiling with "dmd -O bug.d" 1+0i 0+1i 1+1i 0+0i 0+0i 0+0i */ int main( ){ static cdouble[] A = [1, 1i, 1+1i]; int ii; foreach( cdouble z; A ) printf("%.*s ",toString(z)); printf("\n"); for( ii=0; ii<A.length; ii++ ) A[ii] += -1i*A[ii]; foreach( cdouble z; A ) printf("%.*s ",toString(z)); printf("\n"); return 0; } TiagoSame happens with DMD 0.140 on Linux. Tiago -- Tiago Gasiba (M.Sc.) - http://www.gasiba.de Everything should be made as simple as possible, but not simpler.
Nov 25 2005
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Tiago Gasiba schrieb am 2005-11-24:The following code works fine without the -O option (with DMD 0.139 on Linux) but goes crazy with -O: import std.string; /* Different results compiling with "dmd bug.d" 1+0i 0+1i 1+1i 1+-1i 1+1i 2+0i compiling with "dmd -O bug.d" 1+0i 0+1i 1+1i 0+0i 0+0i 0+0i */ int main( ){ static cdouble[] A = [1, 1i, 1+1i]; int ii; foreach( cdouble z; A ) printf("%.*s ",toString(z)); printf("\n"); for( ii=0; ii<A.length; ii++ ) A[ii] += -1i*A[ii]; foreach( cdouble z; A ) printf("%.*s ",toString(z)); printf("\n"); return 0; } TiagoAdded to DStress as http://dstress.kuehne.cn/run/c/cfloat_06.d http://dstress.kuehne.cn/run/c/cdouble_06.d http://dstress.kuehne.cn/run/c/creal_30.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFDiTf03w+/yD4P9tIRAm7JAJsGSjyXmlFxcQNwY6dqLPG0QfCkMACbBN+6 bpf6qLOGfnj3Nmr1ZxFcyJE= =2v7E -----END PGP SIGNATURE-----
Nov 26 2005