digitalmars.D.learn - Scoped local variables
- Jason House (5/5) Dec 07 2007 I'm having my code crash when I add in scope variables. While it works ...
- Denton Cockburn (5/16) Dec 07 2007 Need more information.
- Jason House (24/43) Dec 07 2007 It's a windows error:
- Frank Benoit (3/60) Dec 07 2007 It is a bug. I can reproduce it on linux/dmd.
- Jason House (4/66) Dec 07 2007 Before I'd do, I'd like to know if the following things make a differenc...
- Frank Benoit (2/12) Dec 07 2007 I did it on linux, dmd 1.023, tango
- bearophile (4/7) Dec 07 2007 On DMD v1.024 with Phobos it seems to work to me.
- Denton Cockburn (3/82) Dec 07 2007 1.023 on linux using phobos, it works fine.
- Jason House (3/5) Dec 09 2007 This is now issue 1719.
- =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= (16/37) Dec 07 2007 -----BEGIN PGP SIGNED MESSAGE-----
- Marius Muja (1/23) Dec 07 2007 Works fine on linux with gdc 0.24 and tango.
I'm having my code crash when I add in scope variables. While it works in some cases, it doesn't in others. I've whittled down my current problem to code that looks like: unittest{ scope T t = new T(); } "T" has a bunch of arrays that it allocates and fills when it's constructed. I'm currently confused how this code would cause a crash. Any insights would be much appreciated.
Dec 07 2007
On Fri, 07 Dec 2007 09:52:07 -0500, Jason House wrote:I'm having my code crash when I add in scope variables. While it works in some cases, it doesn't in others. I've whittled down my current problem to code that looks like: unittest{ scope T t = new T(); } "T" has a bunch of arrays that it allocates and fills when it's constructed. I'm currently confused how this code would cause a crash. Any insights would be much appreciated.Need more information. What's the message given when it crashes? Is the cause of the crash the fact that it's scoped? Have you tried without scope? Are you sure it's not in the constructor of T?
Dec 07 2007
Denton Cockburn Wrote:On Fri, 07 Dec 2007 09:52:07 -0500, Jason House wrote:It's a windows error: housebot-0.7 has encountered a problem and needs to close. We are sorry for the inconvenience. If you were in the middle of something, the information you were working on might be lost.I'm having my code crash when I add in scope variables. While it works in some cases, it doesn't in others. I've whittled down my current problem to code that looks like: unittest{ scope T t = new T(); } "T" has a bunch of arrays that it allocates and fills when it's constructed. I'm currently confused how this code would cause a crash. Any insights would be much appreciated.Need more information. What's the message given when it crashes?Is the cause of the crash the fact that it's scoped?As best as I can tell.Have you tried without scope?Yes, it works flawlessly without the scope.Are you sure it's not in the constructor of T?I am now. I stripped it down to an empty constructor and removed all member variables. Since posting, I've reduced this down to a simple example. This example sometimes crashes dmd itself instead of producing a crashing executable. I'm using dmd 1.018 with Tango 0.99. Now that I know it's dmd and not me, I may try upgrading the version of dmd that I use. version=crash; //version=work1; //version=work2; //version=work3; interface I{ } class C : public I{ } unittest{ version(crash) scope I def = new C; version(work1) scope C def = new C; version(work2) I def = new C; version(work3) C def = new C; } int main(){ return 0; }
Dec 07 2007
It is a bug. I can reproduce it on linux/dmd. Would you mind to file a bug report? Jason House schrieb:Denton Cockburn Wrote:On Fri, 07 Dec 2007 09:52:07 -0500, Jason House wrote:It's a windows error: housebot-0.7 has encountered a problem and needs to close. We are sorry for the inconvenience. If you were in the middle of something, the information you were working on might be lost.I'm having my code crash when I add in scope variables. While it works in some cases, it doesn't in others. I've whittled down my current problem to code that looks like: unittest{ scope T t = new T(); } "T" has a bunch of arrays that it allocates and fills when it's constructed. I'm currently confused how this code would cause a crash. Any insights would be much appreciated.Need more information. What's the message given when it crashes?Is the cause of the crash the fact that it's scoped?As best as I can tell.Have you tried without scope?Yes, it works flawlessly without the scope.Are you sure it's not in the constructor of T?I am now. I stripped it down to an empty constructor and removed all member variables. Since posting, I've reduced this down to a simple example. This example sometimes crashes dmd itself instead of producing a crashing executable. I'm using dmd 1.018 with Tango 0.99. Now that I know it's dmd and not me, I may try upgrading the version of dmd that I use. version=crash; //version=work1; //version=work2; //version=work3; interface I{ } class C : public I{ } unittest{ version(crash) scope I def = new C; version(work1) scope C def = new C; version(work2) I def = new C; version(work3) C def = new C; } int main(){ return 0; }
Dec 07 2007
Frank Benoit Wrote:It is a bug. I can reproduce it on linux/dmd. Would you mind to file a bug report?Before I'd do, I'd like to know if the following things make a difference: 1. Tango vs. Phobos 2. Latest D 1.x vs. latest D 2.xJason House schrieb:Denton Cockburn Wrote:On Fri, 07 Dec 2007 09:52:07 -0500, Jason House wrote:It's a windows error: housebot-0.7 has encountered a problem and needs to close. We are sorry for the inconvenience. If you were in the middle of something, the information you were working on might be lost.I'm having my code crash when I add in scope variables. While it works in some cases, it doesn't in others. I've whittled down my current problem to code that looks like: unittest{ scope T t = new T(); } "T" has a bunch of arrays that it allocates and fills when it's constructed. I'm currently confused how this code would cause a crash. Any insights would be much appreciated.Need more information. What's the message given when it crashes?Is the cause of the crash the fact that it's scoped?As best as I can tell.Have you tried without scope?Yes, it works flawlessly without the scope.Are you sure it's not in the constructor of T?I am now. I stripped it down to an empty constructor and removed all member variables. Since posting, I've reduced this down to a simple example. This example sometimes crashes dmd itself instead of producing a crashing executable. I'm using dmd 1.018 with Tango 0.99. Now that I know it's dmd and not me, I may try upgrading the version of dmd that I use. version=crash; //version=work1; //version=work2; //version=work3; interface I{ } class C : public I{ } unittest{ version(crash) scope I def = new C; version(work1) scope C def = new C; version(work2) I def = new C; version(work3) C def = new C; } int main(){ return 0; }
Dec 07 2007
Jason House schrieb:Frank Benoit Wrote:I did it on linux, dmd 1.023, tangoIt is a bug. I can reproduce it on linux/dmd. Would you mind to file a bug report?Before I'd do, I'd like to know if the following things make a difference: 1. Tango vs. Phobos 2. Latest D 1.x vs. latest D 2.x
Dec 07 2007
Jason House:Before I'd do, I'd like to know if the following things make a difference: 1. Tango vs. Phobos 2. Latest D 1.x vs. latest D 2.xOn DMD v1.024 with Phobos it seems to work to me. Bye, bearophile
Dec 07 2007
On Fri, 07 Dec 2007 17:03:19 -0500, Jason House wrote:Frank Benoit Wrote:1.023 on linux using phobos, it works fine. Could it be a tango runtime issue?It is a bug. I can reproduce it on linux/dmd. Would you mind to file a bug report?Before I'd do, I'd like to know if the following things make a difference: 1. Tango vs. Phobos 2. Latest D 1.x vs. latest D 2.xJason House schrieb:Denton Cockburn Wrote:On Fri, 07 Dec 2007 09:52:07 -0500, Jason House wrote:It's a windows error: housebot-0.7 has encountered a problem and needs to close. We are sorry for the inconvenience. If you were in the middle of something, the information you were working on might be lost.I'm having my code crash when I add in scope variables. While it works in some cases, it doesn't in others. I've whittled down my current problem to code that looks like: unittest{ scope T t = new T(); } "T" has a bunch of arrays that it allocates and fills when it's constructed. I'm currently confused how this code would cause a crash. Any insights would be much appreciated.Need more information. What's the message given when it crashes?Is the cause of the crash the fact that it's scoped?As best as I can tell.Have you tried without scope?Yes, it works flawlessly without the scope.Are you sure it's not in the constructor of T?I am now. I stripped it down to an empty constructor and removed all member variables. Since posting, I've reduced this down to a simple example. This example sometimes crashes dmd itself instead of producing a crashing executable. I'm using dmd 1.018 with Tango 0.99. Now that I know it's dmd and not me, I may try upgrading the version of dmd that I use. version=crash; //version=work1; //version=work2; //version=work3; interface I{ } class C : public I{ } unittest{ version(crash) scope I def = new C; version(work1) scope C def = new C; version(work2) I def = new C; version(work3) C def = new C; } int main(){ return 0; }
Dec 07 2007
Frank Benoit wrote:It is a bug. I can reproduce it on linux/dmd. Would you mind to file a bug report?This is now issue 1719. Thanks to everyone for testing this under different configurations.
Dec 09 2007
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Jason House wrote:version=crash; //version=work1; //version=work2; //version=work3; interface I{ } class C : public I{ } unittest{ version(crash) scope I def = new C; version(work1) scope C def = new C; version(work2) I def = new C; version(work3) C def = new C; } int main(){ return 0; }No problem here with gdc 0.24, phobos and 64-bits linux. Jerome - -- +------------------------- Jerome M. BERGER ---------------------+ | mailto:jeberger free.fr | ICQ: 238062172 | | http://jeberger.free.fr/ | Jabber: jeberger jabber.fr | +---------------------------------+------------------------------+ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFHWbcWd0kWM4JG3k8RAnemAJ0RRfV1Xl8CfhkMhR//fqv5kC2k3ACgk5vX yHJYQXSvj98yRCxTHlxVENg= =i1X5 -----END PGP SIGNATURE-----
Dec 07 2007
Jason House wrote:Works fine on linux with gdc 0.24 and tango.version=crash; //version=work1; //version=work2; //version=work3; interface I{ } class C : public I{ } unittest{ version(crash) scope I def = new C; version(work1) scope C def = new C; version(work2) I def = new C; version(work3) C def = new C; } int main(){ return 0; }
Dec 07 2007