digitalmars.D.bugs - [Issue 407] New: casting array literals to int causes compiler seg-fault
- d-bugmail puremagic.com (34/34) Oct 08 2006 http://d.puremagic.com/issues/show_bug.cgi?id=407
- Thomas Kuehne (14/35) Oct 12 2006 -----BEGIN PGP SIGNED MESSAGE-----
- d-bugmail puremagic.com (9/9) Oct 18 2006 http://d.puremagic.com/issues/show_bug.cgi?id=407
http://d.puremagic.com/issues/show_bug.cgi?id=407 Summary: casting array literals to int causes compiler seg-fault Product: D Version: 0.169 Platform: PC OS/Version: Linux Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: aziz.kerim gmail.com The following code demonstrates in which cases the compiler crashes with a segmentation fault: int i; char[1] c = ['0']; i = c[0]; // ok i = *cast(int*)c; // ok //i = *cast(int*)['0']; // compiler seg-fault //i = *cast(int*)cast(char[0])[]; // compiler seg-fault //i = *cast(int*)cast(char[1])['0']; // compiler seg-fault i = *cast(int*)cast(char[1])"0"; // ok i = *cast(int*)cast(char[3])['0']; // ok i = *cast(int*)cast(char[3])['0', '0']; // ok //i = *cast(int*)cast(char[3])['0', '0', '0']; // compiler seg-fault i = *cast(int*)cast(char[4])['0', '0', '0']; // ok //i = *cast(int*)cast(char[4])['0', '0', '0', '0']; // compiler seg-fault i = *cast(int*)cast(char[])['0','0','0']; // ok PS.: This is my first bug report here and I hope it's useful. I really feel a lot enthusiastic about D, and wish it to become more widely used. Thank you very much, Mr Bright, for putting time and effort into creating a very remarkable language! --
Oct 08 2006
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 d-bugmail puremagic.com schrieb am 2006-10-08:http://d.puremagic.com/issues/show_bug.cgi?id=407The following code demonstrates in which cases the compiler crashes with a segmentation fault: int i; char[1] c = ['0']; i = c[0]; // ok i = *cast(int*)c; // ok //i = *cast(int*)['0']; // compiler seg-fault //i = *cast(int*)cast(char[0])[]; // compiler seg-fault //i = *cast(int*)cast(char[1])['0']; // compiler seg-fault i = *cast(int*)cast(char[1])"0"; // ok i = *cast(int*)cast(char[3])['0']; // ok i = *cast(int*)cast(char[3])['0', '0']; // ok //i = *cast(int*)cast(char[3])['0', '0', '0']; // compiler seg-fault i = *cast(int*)cast(char[4])['0', '0', '0']; // ok //i = *cast(int*)cast(char[4])['0', '0', '0', '0']; // compiler seg-fault i = *cast(int*)cast(char[])['0','0','0']; // ok PS.: This is my first bug report here and I hope it's useful. I really feel a lot enthusiastic about D, and wish it to become more widely used. Thank you very much, Mr Bright, for putting time and effort into creating a very remarkable language!Added to DStress as http://dstress.kuehne.cn/run/c/cast_32_A.d http://dstress.kuehne.cn/run/c/cast_32_B.d http://dstress.kuehne.cn/run/c/cast_32_C.d http://dstress.kuehne.cn/run/c/cast_32_D.d Thomas -----BEGIN PGP SIGNATURE----- iD4DBQFFLlTFLK5blCcjpWoRAoX0AJ9mwZ72IEYtKsmufmo5Iutsf2Z3VwCYql6A XtBSgF2TTmkH5gOkkQjvZw== =n32d -----END PGP SIGNATURE-----
Oct 12 2006
http://d.puremagic.com/issues/show_bug.cgi?id=407 bugzilla digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED Fixed DMD 0.170 --
Oct 18 2006