digitalmars.D.bugs - [Issue 22484] New: dmd generates wrong code for certain
- d-bugmail puremagic.com (45/45) Nov 05 2021 https://issues.dlang.org/show_bug.cgi?id=22484
https://issues.dlang.org/show_bug.cgi?id=22484 Issue ID: 22484 Summary: dmd generates wrong code for certain parameter/return sizes Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: stanislav.blinov gmail.com The assert in `bug` below triggers with and without -O. Test is definitely not minimal, but it's as far as I had the time to narrow it. --- // Comment out the align to make the bug disappear align(16) struct Param { uint x; } struct Result { // Set num elements to 4 to make the bug disappear int[8] a; } void* actual; // global just for assert // Comment out the `, int dummy=0` to make the bug disappear auto bug(void* arg, Param param, uint u, void delegate() a, void delegate() b, int dummy=0) { assert(arg == actual); return Result.init; } // Actual codebase was betterC, but this should compile with and without -betterC extern(C) int main(int argc, char** argv) { actual = argv[0]; actual.bug(Param.init, 0, {}, {}); return 0; } --
Nov 05 2021