extracted from std.format unittests: //////////////////////////////////// enum size = 5; char[size] ret() { char[size] hello = "hello world"[0..size]; return hello; } void test(char[size] txt) { assert(txt == "hello world"[0..size]); // fails } void main() { auto r = ret(); assert(r == "hello world"[0..size]); // passes test(r); } ///////////////////////////////////// compile with "dmd -m64 test.d" to trigger the assertion. This happens for array sizes 5, 6 and 7. This might be related to issue 9586.
Smaller test case: int test(char[5] txt) { return txt[0] + txt[1] + txt[4]; } void main() { char[5] hello = void; hello[0] = 8; hello[1] = 9; hello[4] = 10; int i = test(hello); assert(i == 27); }
https://github.com/D-Programming-Language/dmd/pull/2391
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/92251d67a0a59d4c22d6cb8c7e7557f8d0109bf3 fix Issue 10678 - Win64: wrong code passing small fixed sized array as function argument https://github.com/D-Programming-Language/dmd/commit/e0eefafa57a5f765f44268507213991ebaacc9db Merge pull request #2391 from WalterBright/fix10678 fix Issue 10678 - Win64: wrong code passing small fixed sized array as f...
Commit pushed to dmd-1.x at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/31b45dbc23f75465b87f25168f4a3ae2bfdc31b2 Merge pull request #2391 from WalterBright/fix10678 fix Issue 10678 - Win64: wrong code passing small fixed sized array as f...