www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22583] New: Corrupted function parameters

https://issues.dlang.org/show_bug.cgi?id=22583

          Issue ID: 22583
           Summary: Corrupted function parameters
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: ryuukk.dev gmail.com

I encountered a weird bug

Parameter gets corrupted, the following code works fine with LDC, but with dmd
v2.098.0 it doesn't!

https://run.dlang.io/is/T1uuT5

```
import std;

void main()
{
    draw(null, 
            Rectf(0, 0, 256,256),
            64,64,
            0,0,
            128,128,
            1, 1, 0
    );
}

void draw (void* texture,
        Rectf region,
        float x, float y,
        float originX, float originY,
        float width, float height,
            float scaleX, float scaleY, float rotation) 
{
    assert(texture == null);
    assert(region.x == 0);
    assert(region.y == 0);
    assert(region.width == 256);
    assert(region.height == 256);
}

struct Rectf
{
    float x = 0;
    float y = 0;
    float width = 0;
    float height = 0;
}
```

--
Dec 10 2021