[Issue 14510] Bad tail call optimization with static arrays
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Aug 30 06:02:31 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14510
tbanelwebmin at free.fr changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tbanelwebmin at free.fr
--- Comment #5 from tbanelwebmin at free.fr ---
I came across something similar.
The following program crashes on assert,
but only when compiled with -O
DMD64 D Compiler v2.068.0
----------------------------
struct SomeStruct
{
void fff (int n)
{
SomeStruct next;
assert (&next != &this);
if (n)
next.fff(n-1);
}
}
void main()
{
SomeStruct root;
root.fff(2);
}
----------------------------
As a workaround, add
return 3;
at the end of fff
and change void to int
--
More information about the Digitalmars-d-bugs
mailing list