2 /* This test case was originally written by Nicholas Nethercote. */
7 /* For 'x', we get an uninitialised error for every addition to it. For
8 each one we get one origin identified, even though most of them involve
9 more than one undefined value. */
11 /* For 'y', we get a single uninitialised value error, on the value handed
12 to the exit() system call. Fair enough.
14 An important question is: which of the origins is reported in the
15 error? Well, considering that (1) m_execontext allocates ECUs
16 (origin tags, basically) in increasing order, and (2) memcheck's
17 instrumentation for dealing with two uninitialised sources simply
18 involves 'max'-ing the otags, we expect the origin to be attributed
19 to the last of the 8 mallocs, that is, to p_ui8.
30 // Do them separately rather than all in one array so they all have
32 int* p_ui1
= malloc(sizeof(int));
33 int* p_ui2
= malloc(sizeof(int));
34 int* p_ui3
= malloc(sizeof(int));
35 int* p_ui4
= malloc(sizeof(int));
36 int* p_ui5
= malloc(sizeof(int));
37 int* p_ui6
= malloc(sizeof(int));
38 int* p_ui7
= malloc(sizeof(int));
39 int* p_ui8
= malloc(sizeof(int));
49 #define P printf("huh?")
51 x
+= (ui1
== 0x12345678 ? P
: 23);
52 x
+= (ui1
+ui2
== 0x12345678 ? P
: 24);
53 x
+= (ui1
+ui2
+ui3
== 0x12345678 ? P
: 25);
54 x
+= (ui1
+ui2
+ui3
+ui4
== 0x12345678 ? P
: 26);
55 x
+= (ui1
+ui2
+ui3
+ui4
+ui5
== 0x12345678 ? P
: 27);
56 x
+= (ui1
+ui2
+ui3
+ui4
+ui5
+ui6
== 0x12345678 ? P
: 28);
57 x
+= (ui1
+ui2
+ui3
+ui4
+ui5
+ui6
+ui7
== 0x12345678 ? P
: 29);
58 x
+= (ui1
+ui2
+ui3
+ui4
+ui5
+ui6
+ui7
+ui8
== 0x12345678 ? P
: 30);
62 y
+= (ui1
+ui2
+ui3
);
63 y
+= (ui1
+ui2
+ui3
+ui4
);
64 y
+= (ui1
+ui2
+ui3
+ui4
+ui5
);
65 y
+= (ui1
+ui2
+ui3
+ui4
+ui5
+ui6
);
66 y
+= (ui1
+ui2
+ui3
+ui4
+ui5
+ui6
+ui7
);
67 y
+= (ui1
+ui2
+ui3
+ui4
+ui5
+ui6
+ui7
+ui8
);