blob: e439c40625a615eca6a7021940d200344c2bd722 (
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
|
/* APPLE LOCAL file 4516827 PR 26643 */
/* { dg-options "-std=c99 -O1" } */
/* { dg-do run } */
#include <string.h>
extern void abort(void);
typedef union
{
long rgb;
struct
{
unsigned char unused;
unsigned char ciBlue;
unsigned char ciGreen;
unsigned char ciRed;
} cis;
} CVTest;
int validate (long) __attribute__((noinline));
int validate (long a) {
if (a != 0)
abort();
}
int placeholder (unsigned char, unsigned char, unsigned char) __attribute((noinline));
int placeholder (unsigned char a, unsigned char b, unsigned char c) {
a; b; c; }
typedef unsigned char bool;
int main (int argc, char * const argv[]) {
long index;
const long kNumCV = 3;
CVTest theCV[kNumCV];
memset(theCV, 0, sizeof(theCV));
theCV[0].cis.ciRed = 10;
theCV[0].cis.ciGreen = 10;
theCV[0].cis.ciBlue = 10;
theCV[1].cis.ciRed = 1;
theCV[1].cis.ciGreen = 1;
theCV[1].cis.ciBlue = 1;
theCV[2].cis.ciRed = 0;
theCV[2].cis.ciGreen = 0;
theCV[2].cis.ciBlue = 0;
CVTest *hpcvT = &theCV[0];
for (index = 0; index < kNumCV; ++index)
{
bool a, b, c;
placeholder(hpcvT->cis.ciRed, hpcvT->cis.ciGreen, hpcvT->cis.ciBlue);
a = (hpcvT->cis.ciRed != hpcvT->cis.ciGreen);
b = (hpcvT->cis.ciGreen != hpcvT->cis.ciBlue);
c = ((hpcvT->cis.ciRed != hpcvT->cis.ciGreen) || (hpcvT->cis.ciGreen != hpcvT->cis.ciBlue));
validate ((long)a);
validate ((long)b);
validate ((long)c);
hpcvT++;
}
return 0;
}
|