https://issues.dlang.org/show_bug.cgi?id=19672
Issue ID: 19672 Summary: Function uses the stack to read a static array parameter but it is passed in the registers Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Keywords: wrong-code Severity: regression Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: b2.t...@gmx.com ``` struct S { ulong c; bool b; // removing this prevents bug } // increase the struct size at least to 17 bytes also prevents the bug. void main() { S[1] a = [S(42)]; assert(a[0].c == 42); /* Passes. */ f(a); } void f(S[1] a) { assert(a[0].c == 42); /* Fails. */ } ``` After inspection of the produced asm it appeared that the parameter `a` is passed in the registers RDI (a[0].c) and RSI (a[0].b) but when reading the value for the assertion the stack is used instead (proof : https://forum.dlang.org/post/modqrqwsqvhxodtli...@forum.dlang.org). --