Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
December 03, 2004 undefined case identifier can crash dmd compiler | ||||
---|---|---|---|---|
| ||||
This is somewhat obscure, but if you have a switch statement with a structure member as the expression, and you have an undefined identifier in one of your case statements, the compiler will crash after reporting the error. Here's code to reproduce the problem (WinXP, DMD 0.108): (sorry about the formatting, but I haven't figured out how to get the Direct Read Newsreader to preserve indents). struct test { uint a; uint b; } int main() { test tv; tv.a = 1; switch( tv.a ) { case UNDEF_VALUE: break; } return 0; } - Geoff Hickey |
December 03, 2004 Re: undefined case identifier can crash dmd compiler | ||||
---|---|---|---|---|
| ||||
Posted in reply to Geoff Hickey | -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Geoff Hickey schrieb am Fri, 3 Dec 2004 00:52:23 +0000 (UTC): > This is somewhat obscure, but if you have a switch statement with a structure member as the expression, and you have an undefined identifier in one of your case statements, the compiler will crash after reporting the error. This is interesting: if the struct member is an uint the compiler segfaults, if the struct member is an int the compiler doesn't segfault. Added to DStress as http://svn.kuehne.cn/dstress/nocompile/bug_20041203_A.d http://svn.kuehne.cn/dstress/nocompile/bug_20041203_B.d Thomas -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.9.12 (GNU/Linux) iD8DBQFBsGbB3w+/yD4P9tIRAoxZAJ0UjJ98oc7CDaxdENx8wUfleCECPQCeKIdm pfTQZI3MYHF70am1ke/TQ/k= =vZN/ -----END PGP SIGNATURE----- |
December 03, 2004 Re: undefined case identifier can crash dmd compiler | ||||
---|---|---|---|---|
| ||||
Posted in reply to Thomas Kuehne | On Fri, 3 Dec 2004 14:14:41 +0100, Thomas Kuehne <thomas-dloop@kuehne.thisisspam.cn> wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Geoff Hickey schrieb am Fri, 3 Dec 2004 00:52:23 +0000 (UTC): >> This is somewhat obscure, but if you have a switch statement with a structure >> member as the expression, and you have an undefined identifier in one of your >> case statements, the compiler will crash after reporting the error. > > This is interesting: if the struct member is an uint the compiler > segfaults, if the struct member is an int the compiler doesn't segfault. > > Added to DStress as > http://svn.kuehne.cn/dstress/nocompile/bug_20041203_A.d > http://svn.kuehne.cn/dstress/nocompile/bug_20041203_B.d > > Thomas > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.9.12 (GNU/Linux) > > iD8DBQFBsGbB3w+/yD4P9tIRAoxZAJ0UjJ98oc7CDaxdENx8wUfleCECPQCeKIdm > pfTQZI3MYHF70am1ke/TQ/k= > =vZN/ > -----END PGP SIGNATURE----- Sounds like someone's going to be reducing this... (DMD sure has a lot of really weird bugs, doesn't it?) -- "Unhappy Microsoft customers have a funny way of becoming Linux, Salesforce.com and Oracle customers." - www.microsoft-watch.com: "The Year in Review: Microsoft Opens Up" "Changes/Additions -------------------------------------------------------------------------------- HL2DM released! " - HL2DM changelog "#$#@% YES!" - ME |
December 03, 2004 [Patch] Re: undefined case identifier can crash dmd compiler | ||||
---|---|---|---|---|
| ||||
Posted in reply to Simon Buchan | -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 NotDashEscaped: You need GnuPG to verify this message >>> This is somewhat obscure, but if you have a switch statement with a >>> structure >>> member as the expression, and you have an undefined identifier in one >>> of your >>> case statements, the compiler will crash after reporting the error. at least part of the problem can be resolved: --- expression.org.c 2004-12-03 19:56:15.504405552 +0100 +++ expression.c 2004-12-03 19:56:27.577570152 +0100 @@ -391,7 +391,7 @@ integer_t Expression::toInteger() { //printf("Expression %s\n", Token::toChars(op)); -*(char*)0=0; + //*(char*)0=0; error("Integer constant expression expected instead of %s", toChars()); return 0; } Thomas -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.9.12 (GNU/Linux) iD4DBQFBsLfk3w+/yD4P9tIRAnVWAKCuoq65UEzdaZFHJ9hRhc7Qtsa2uwCSA8iI wD4R5aXszBupTO0tDKRnFQ== =yNF6 -----END PGP SIGNATURE----- |
December 05, 2004 Re: undefined case identifier can crash dmd compiler | ||||
---|---|---|---|---|
| ||||
Posted in reply to Geoff Hickey | It's fixed now. The compiler now puts out: test.d(14): undefined identifier UNDEF_VALUE test.d(14): Integer constant expression expected instead of UNDEF_VALUE as it should. |
Copyright © 1999-2021 by the D Language Foundation