[Issue 22484] New: dmd generates wrong code for certain parameter/return sizes
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Nov 5 16:56:52 UTC 2021
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 at puremagic.com
Reporter: stanislav.blinov at 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;
}
--
More information about the Digitalmars-d-bugs
mailing list