digitalmars.D.bugs - [Issue 6510] New: [CTFE] internal error: illegal stack value stack
- d-bugmail puremagic.com (27/27) Aug 16 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6510
- d-bugmail puremagic.com (13/25) Aug 16 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6510
- d-bugmail puremagic.com (7/7) Aug 17 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6510
- d-bugmail puremagic.com (9/9) Aug 17 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6510
- d-bugmail puremagic.com (13/13) Aug 17 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6510
- d-bugmail puremagic.com (26/26) Aug 17 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6510
- d-bugmail puremagic.com (40/40) Aug 17 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6510
- d-bugmail puremagic.com (7/7) Aug 17 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6510
- d-bugmail puremagic.com (28/28) Aug 19 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6510
- d-bugmail puremagic.com (12/12) Aug 22 2011 http://d.puremagic.com/issues/show_bug.cgi?id=6510
http://d.puremagic.com/issues/show_bug.cgi?id=6510 Summary: [CTFE] internal error: illegal stack value stack Product: D Version: D2 Platform: Other OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: dmitry.olsh gmail.com --- Comment #0 from Dmitry Olshansky <dmitry.olsh gmail.com> 2011-08-16 13:39:07 PDT --- Recently found this one in my GSOC project. As this involves compilation of regex at CTFE, I'm not yet able to produce small test case. dmd spits this: ..\..\fred.d(2020): Error: CTFE internal error: illegal stack value stack Assertion failure: 'isStackValueValid(newval)' on line 5452 in file 'interpret.c' abnormal program termination But anyway, what kind of situation is supposed to trigger that assert? My dmd is 2.055 compiled form github with last commit being: Merge pull request #293 from 9rnsr/fix2246 4a1c9e7646ed9152f9644cd29d07968583888cb2 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 16 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6510 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clugdbug yahoo.com.au --- Comment #1 from Don <clugdbug yahoo.com.au> 2011-08-16 19:32:55 PDT --- (In reply to comment #0)Recently found this one in my GSOC project. As this involves compilation of regex at CTFE, I'm not yet able to produce small test case. dmd spits this: ..\..\fred.d(2020): Error: CTFE internal error: illegal stack value stack Assertion failure: 'isStackValueValid(newval)' on line 5452 in file 'interpret.c' abnormal program termination But anyway, what kind of situation is supposed to trigger that assert?Any kind of CTFE assignment involving a non-reference type, that wasn't tested. The few lines involving the variable 'stack' around line 2020 will be the only ones involved in the bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 16 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6510 --- Comment #2 from Dmitry Olshansky <dmitry.olsh gmail.com> 2011-08-17 02:52:42 PDT --- Created an attachment (id=1018) test case, stripped down parser -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 17 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6510 --- Comment #3 from Dmitry Olshansky <dmitry.olsh gmail.com> 2011-08-17 02:55:11 PDT --- I've managed to get a resonably sized test case. Apparently it has soemthing to do with -inline: dmd fred.d // Ok dmd -inline fred.d //same error as before -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 17 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6510 Dmitry Olshansky <dmitry.olsh gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|[CTFE] internal error: |[CTFE] "internal error: |illegal stack value stack |illegal stack value" when | |compiled with -inline --- Comment #4 from Dmitry Olshansky <dmitry.olsh gmail.com> 2011-08-17 02:57:06 PDT --- I haven't made this point clear enough I think: the full source also fails only with -inline. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 17 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6510 --- Comment #5 from Don <clugdbug yahoo.com.au> 2011-08-17 06:52:06 PDT --- Partially reduced test case. The UNUSED static function seems to be necessary. struct Stack(U) { struct Proxy { int[] data; void shrink(){ data = data[0..0]; } } Proxy stack; void pop() { stack.shrink(); } } int bug6510() { static void UNUSED() { Stack!(int) junk; junk.pop(); } Stack!(int) opstk; opstk.pop(); return 3; } static assert(bug6510()); -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 17 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6510 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |ice-on-valid-code --- Comment #6 from Don <clugdbug yahoo.com.au> 2011-08-17 08:34:41 PDT --- Reduced slightly further. If you uncomment the alias, everything works. So this is a bug which only happens when the semantic pass, and the inlining, is run on Stack!int *during* CTFE. The stack.shrink() call gets translated into: ref Proxy ths = this.stack; which CTFE chokes on. Note that this is a local reference variable, which isn't legal D (it can only happen in compiler-generated code). When the alias is present, the inline scan of bug6510() doesn't happen until after CTFE has finished. But interestingly an inline scan of UNUSED() still happens during CTFE. --- struct Stack(U) { struct Proxy { void shrink() {} } Proxy stack; void pop() { stack.shrink(); } } alias Stack!int Stuck; int bug6510() { static void UNUSED() { Stack!(int) junk; junk.pop(); } Stack!(int) opstk; opstk.pop(); return 3; } static assert(bug6510()); -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 17 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6510 --- Comment #7 from Dmitry Olshansky <dmitry.olsh gmail.com> 2011-08-17 08:52:15 PDT --- Thanks for getting a workaround so fast, it's just awesome. I confirm that the full source works after I added aliases to Stack!(x). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 17 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6510 --- Comment #9 from Don <clugdbug yahoo.com.au> 2011-08-19 05:53:36 PDT --- Further reduced, showing that templates are not required. Seems to require an inlined member function call to a member of a nested struct, called from a nested function. No alias trick works in this case. struct Stack6510 { struct Proxy { void shrink() {} } Proxy stack; void pop() { stack.shrink(); } } int bug6510() { static int used() { Stack6510 junk; junk.pop(); return 3; } return used(); } void main() { static assert(bug6510()==3); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 19 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6510 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED --- Comment #10 from Walter Bright <bugzilla digitalmars.com> 2011-08-22 22:47:32 PDT --- https://github.com/D-Programming-Language/dmd/commit/563a291a5c7757fca87685909afa37100e3b44f6 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Aug 22 2011