Thread overview
[Issue 18189] [asan] stack-overflow in optelem
January 04
https://issues.dlang.org/show_bug.cgi?id=18189

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #1 from Walter Bright <bugzilla@digitalmars.com> ---
The failing test case is:

  string gen() {
    string m;
    foreach(i; 0..4096)
        m ~= "mixin(\"assert(0);\n\n\n\n\");\n";
    return m;
  }

  void main() {
    mixin(gen());
  }

--
January 04
https://issues.dlang.org/show_bug.cgi?id=18189

--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> ---
This is a stack overflow caused by having 4096 expression statements. The compiler joins them with a commaexpression, and then recursively traverses it. The best fix would be to convert it to an array or list of expression statements, but that would have ripple effects throughout the back end.

--
January 04
https://issues.dlang.org/show_bug.cgi?id=18189

--- Comment #3 from Martin Nowak <code@dawg.eu> ---
Not sure it's worthwhile to fix it, maybe just add a recursion limit to optelem?

--