summaryrefslogtreecommitdiff
path: root/support/regression/tests/bug-3564.c
blob: 06a42770adae611f6434c68177d5a6adc24623fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* bug-3523.c
   An issue in handling designated initializers where the order of initalization is reversed vs. the order of members.
 */

#include <testfwk.h>

typedef struct {
    char *current;
    int x;
} BlockData1;

typedef struct {
    char *current;
    int x;
    long l;
} BlockData2;

void g1(int i, char *c)
{
	ASSERT (i == 110);
	ASSERT (c == 0);
}

void g2(int i, char *c, long l)
{
	ASSERT (i == 110);
	ASSERT (c == 0);
	ASSERT (l == 0);
}

void g3(int i, char *c, long l)
{
	ASSERT (i == 110);
	ASSERT (c == 0);
	ASSERT (l == 42);
}

void g4(int i, char *c, long l)
{
	ASSERT (i == 110);
	ASSERT (c == 0);
	ASSERT (l == 0);
}

void f1(void)
{
    BlockData1 block = { .x = 110, .current = 0 };

	g1 (block.x, block.current );
}

void f2(void)
{
    BlockData2 block = { .x = 110, .current = 0 };

	g2 (block.x, block.current, block.l );
}

void f3(void)
{
    BlockData2 block = { .x = 110, .l = 42 };

	g3 (block.x, block.current, block.l );
}

void f4(void)
{
    BlockData2 block = { .x = 110};

	g4 (block.x, block.current, block.l );
}

void
testBug (void) {
	f1 ();
	f2 ();
	f3 ();
	f4 ();
}