Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / bug-2582.c
blob85dea3977ab595d19e0d305547443d479acf71b3
1 /*
2 bug-2195.c
4 A z80 parameter passing bug.
5 */
7 #include <testfwk.h>
9 typedef unsigned char u8;
11 typedef struct WindowPositionStruct
13 u8 mX;
14 u8 mY;
15 } WindowPosition;
17 typedef struct WindowSizeStruct
19 u8 mW;
20 u8 mH;
21 } WindowSize;
23 typedef struct WindowPositionAndSizeStruct
25 WindowPosition mPosition;
26 WindowSize mSize;
27 } WindowPositionAndSize;
29 typedef struct WindowRenderStyleStruct
31 u8 mStateColor[4];
32 } WindowRenderStyle;
34 typedef struct WindowStruct
36 WindowPositionAndSize mPositionAndSize;
38 WindowRenderStyle* mpStyle;
39 } Window;
41 void BG_FillRect( u8 x, u8 y, u8 w, u8 h, u8 f)
43 ASSERT(x == 1);
44 ASSERT(y == 2);
45 ASSERT(w == 3);
46 ASSERT(h == 4);
47 ASSERT(f == 0);
50 static Window gWindow;
51 static WindowRenderStyle gWindowRenderStyle;
53 void testBug(void)
55 u8 state = 0;
56 gWindow.mpStyle = &gWindowRenderStyle;
57 gWindow.mPositionAndSize.mPosition.mX = 1;
58 gWindow.mPositionAndSize.mPosition.mY = 2;
59 gWindow.mPositionAndSize.mSize.mW = 3;
60 gWindow.mPositionAndSize.mSize.mH = 4;
63 Window* pWindow = &gWindow;
65 BG_FillRect(
66 pWindow->mPositionAndSize.mPosition.mX,
67 pWindow->mPositionAndSize.mPosition.mY,
68 pWindow->mPositionAndSize.mSize.mW,
69 pWindow->mPositionAndSize.mSize.mH,
70 pWindow->mpStyle->mStateColor[state]