[Issue 16555] Stack corruption when calling multi-parameter outer function from nested function

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Sep 27 15:33:08 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16555

Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com

--- Comment #1 from Steven Schveighoffer <schveiguy at yahoo.com> ---
The stack corruption I think is on the expected location of x when calling the
function.

Note that outer function is not needed, this also produces (same) corrupt
output:

import std.stdio;

void main()
{
    void inner(double x)
    {
        if(x == 999) // to show that x itself isn't corrupt
        {
            writefln("x=%s a=%s b=%s c=%s d=%s e=%s f=%s g=%s h=%s", x, 1.0,
2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0);
            //outer(x, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0);
        }
    }

    inner(999.0);
}

Not sure how to edit the description, but definitely the number of parameters
plays a role, and probably the inner function.

--


More information about the Digitalmars-d-bugs mailing list