digitalmars.D.bugs - [Issue 2475] New: -inline breaks man or boy
- d-bugmail puremagic.com Nov 27 2008
- d-bugmail puremagic.com Jan 11 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2475 Summary: -inline breaks man or boy Product: D Version: unspecified Platform: PC OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: bugzilla digitalmars.com Wed, 26 Nov 2008 17:02:54 -0500, bearophile wrote:While on DMD 1.036 the following code: // code #2 import std.c.stdio: printf; int a(int k, lazy int x1, lazy int x2, lazy int x3, lazy int x4, lazy int x5) { int b() { k -= 1; return a(k, b(), x1, x2, x3, x4); } return k <= 0 ? x4 + x5 : b(); } void main() { printf("%d\n", a(24, 1, -1, -1, 1, 0)); } Outputs at compile time: man_or_boy2.d(6): delegate man_or_boy2.a.b.__dgliteral1 is a nested function and cannot be accessed from a man_or_boy2.d(6): delegate man_or_boy2.a.b.__dgliteral2 is a nested function and cannot be accessed from a man_or_boy2.d(6): delegate man_or_boy2.a.b.__dgliteral3 is a nested function and cannot be accessed from a man_or_boy2.d(6): delegate man_or_boy2.a.b.__dgliteral4 is a nested function and cannot be accessed from a man_or_boy2.d(6): delegate man_or_boy2.a.b.__dgliteral5 is a nested function and cannot be accessed from a But this code works on the codepad site, that uses DMD v.1.026 (I think with Tangobos), up to N=21 (then the site goes into timeout for safety): http://codepad.org/8GtKswm8
[snip]All the following compilations are done with and N=20 and: dmd -O -release -inline -L/STACK:1700000000 man_or_boy.d dmd -O -release -inline -L/STACK:1700000000 man_or_boy2.d
Remove -inline from your compiler options, and #2 compiles and runs faster in both D1 and D2 than #1. lazy seems to do something funny when -inline is in effect. --
Nov 27 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2475 smjg iname.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |smjg iname.com Status|NEW |RESOLVED Resolution| |DUPLICATE ------- Comment #1 from smjg iname.com 2009-01-11 16:47 ------- Not sure how this has stayed ignorant of 2474's existence for so long.... *** This bug has been marked as a duplicate of 2474 *** --
Jan 11 2009








d-bugmail puremagic.com