Thread overview
[Issue 18189] [asan] stack-overflow in optelem
Jan 04, 2018
Walter Bright
Jan 04, 2018
Walter Bright
Jan 04, 2018
Martin Nowak
Dec 17, 2022
Iain Buclaw
January 04, 2018
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, 2018
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, 2018
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?

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=18189

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P3

--