Thread overview | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
January 17, 2007 [Issue 852] New: ICE in dmd with anon. delegate in static class ctor in unittest | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=852 Summary: ICE in dmd with anon. delegate in static class ctor in unittest Product: D Version: 1.00 Platform: PC OS/Version: Windows Status: NEW Keywords: ice-on-valid-code Severity: minor Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: daniel.keep+d.puremagic.com@gmail.com Description: If you attempt to compile code where there is a static constructor which creates an anonymous delegate which instantiates the class itself, all of which is in a unit test, with the "-unittest" switch, DMD crashes with an ICE. Steps to reproduce: 1) Attempt to compile code below with the command "dmd -unittest ice.d". Actual result: The following message: "Internal error: toir.c 170" Expected result: Either a normal compilation error, or compilation success. Compiler: Digital Mars D Compiler v1.0, WinXP SP2. Code to reproduce: (ice.d) unittest { class Foo { static this() { auto i = {return new Foo;}; } this() {} } } void main() {} -- |
February 23, 2007 [Issue 852] ICE in dmd with anon. delegate in static class ctor in unittest | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=852 thomas-dloop@kuehne.cn changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|ice-on-valid-code | ------- Comment #1 from thomas-dloop@kuehne.cn 2007-02-23 16:36 ------- The code isn't legal: 1 # void test(){ 2 # class Foo{ 3 # static this(){ 4 # auto i = { 5 # return new Foo; 6 # }; 7 # } 8 # } 9 # } Line 5 requires access to test's context pointer, thus it should fail because line 3 can't provide one. Change "class Foo" to "static class Foo" to sidestep the problem. Added to DStress as http://dstress.kuehne.cn/nocompile/b/bug_toir_170_A.d http://dstress.kuehne.cn/nocompile/b/bug_toir_170_B.d -- |
September 19, 2007 [Issue 852] ICE in dmd with anon. delegate in static class ctor in unittest | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=852 smjg@iname.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |smjg@iname.com Keywords| |ice-on-invalid-code ------- Comment #2 from smjg@iname.com 2007-09-19 06:56 ------- Indeed, it compiles if the class is made static. But why? Where has it got a context pointer from? -- |
May 27, 2009 [Issue 852] ICE(toir.c) using local class in non-static nested function in nested static function | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=852 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|ICE(toir.c) in dmd with |ICE(toir.c) using local |anon. delegate in static |class in non-static nested |class ctor in unittest |function in nested static | |function --- Comment #3 from Don <clugdbug@yahoo.com.au> 2009-05-27 04:32:51 PDT --- Changed name from ICE(toir.c) in dmd with anon. delegate in static class ctor in unittest, since it has nothing to do with delegates, static class constructors, or unittest! This reduced test case shows that it's caused by use of new of local class, inside a non-static function nested inside static local function. --- void bar() { class Foo { } static void foo() { void pug() { Foo z = new Foo; } } } --- If you move the 'static' from foo to pug, you get the error: void bar() { class Foo { } void foo() { static void pug() { Foo z = new Foo; } } } ice.d(8): Error: function ice.bar is a nested function and cannot be accessed fr om pug But this seems to be a rejects-valid to me -- I can't see any reason why a static nested function couldn't access a local class. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 27, 2009 [Issue 852] ICE(toir.c) using local class in non-static nested function in nested static function | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=852 Tomas Lindquist Olsen <tomas@famolsen.dk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomas@famolsen.dk --- Comment #4 from Tomas Lindquist Olsen <tomas@famolsen.dk> 2009-05-27 04:40:48 PDT --- It's because the local class is not marked static, and thus needs a reference to bar's stack frame, which is unreachable from pug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 27, 2009 [Issue 852] ICE(toir.c) using local class in non-static nested function in nested static function | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=852 --- Comment #5 from Tomas Lindquist Olsen <tomas@famolsen.dk> 2009-05-27 04:46:15 PDT --- Both test cases work correctly in LDC by giving an error: $ ldc foo.d foo.d(5): Error: outer function context of foo.bar is needed to 'new' nested class foo.bar.Foo $ ldc foo2.d foo.d(5): Error: outer function context of foo2.bar is needed to 'new' nested class foo2.bar.Foo This is most likely because we moved the error checking out of codegen and into the frontend (where it belongs). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 27, 2009 [Issue 852] ICE(toir.c) using local class in non-static nested function in nested static function | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=852 --- Comment #6 from Tomas Lindquist Olsen <tomas@famolsen.dk> 2009-05-27 04:49:17 PDT --- You can see: http://dsource.org/projects/ldc/browser/dmd/expression.c#L3589 for details. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 27, 2009 [Issue 852] ICE(toir.c) using local class in non-static nested function in nested static function | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=852 --- Comment #7 from Don <clugdbug@yahoo.com.au> 2009-05-27 05:35:50 PDT --- Created an attachment (id=383) --> (http://d.puremagic.com/issues/attachment.cgi?id=383) Patch against DMD2.030. This is simply copied from LDC. It works without modification on DMD2 and DMD1. (Gives a nicer error message, too). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 27, 2009 [Issue 852] ICE(toir.c) using local class in non-static nested function in nested static function | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=852 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch Severity|minor |major -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 09, 2009 [Issue 852] ICE(toir.c) using local class in non-static nested function in nested static function | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=852 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED --- Comment #8 from Walter Bright <bugzilla@digitalmars.com> 2009-07-09 02:45:07 PDT --- Fixed dmd 1.046 and 2.031 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation