Summary: Passing large structs to function b value causes stack
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Rainer Schuetze <> 2012-09-14 01:41:33 
PDT ---
If the arguments passed to a function exceed 64kB the stack gets corrupted.
Compiling and running this code without optimizations leads to a crash:

struct S
    int[16385] a;

void foo(S s)

void main()
    S s;
    for(int i = 0; i < 100; i++)

This is caused by the frame pointer cleanup only popping the lower 16 bit of
the used stack size:

_D4test3fooFS4test1SZv  comdat
        assume  CS:_D4test3fooFS4test1SZv
                ret     4
_D4test3fooFS4test1SZv  ends

[Actually I never meant to do this, it happened because I thought I was passing
a class reference.]

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to