Thread overview | |||||
---|---|---|---|---|---|
|
October 08, 2006 [Issue 407] New: casting array literals to int causes compiler seg-fault | ||||
---|---|---|---|---|
| ||||
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! -- |
October 12, 2006 Re: [Issue 407] New: casting array literals to int causes compiler seg-fault | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail Attachments: | d-bugmail@puremagic.com schrieb am 2006-10-08: > http://d.puremagic.com/issues/show_bug.cgi?id=407 > 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! 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 |
October 18, 2006 [Issue 407] casting array literals to int causes compiler seg-fault | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=407 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #2 from bugzilla@digitalmars.com 2006-10-18 13:24 ------- Fixed DMD 0.170 -- |
Copyright © 1999-2021 by the D Language Foundation