digitalmars.D.bugs - undefined case identifier can crash dmd compiler
- Geoff Hickey (23/23) Dec 02 2004 This is somewhat obscure, but if you have a switch statement with a stru...
- Thomas Kuehne (15/18) Dec 03 2004 -----BEGIN PGP SIGNED MESSAGE-----
- Simon Buchan (14/34) Dec 03 2004 Sounds like someone's going to be reducing this... (DMD sure has a lot
- Thomas Kuehne (23/28) Dec 03 2004 -----BEGIN PGP SIGNED MESSAGE-----
- Walter (4/4) Dec 04 2004 It's fixed now. The compiler now puts out:
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
Dec 02 2004
-----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-----
Dec 03 2004
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):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 - METhis 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-----
Dec 03 2004
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 NotDashEscaped: You need GnuPG to verify this messageat 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-----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.
Dec 03 2004
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.
Dec 04 2004