111
|
1 /* PR middle-end/6950
|
|
2 gcc 3.0.4 mistakenly set lhs.low to 0 at the beginning of the num_eq
|
|
3 expansion; it should use a temporary.
|
|
4 /* { dg-do run } */
|
|
5
|
|
6 typedef struct cpp_num cpp_num;
|
|
7 struct cpp_num
|
|
8 {
|
|
9 long high;
|
|
10 long low;
|
|
11 char overflow;
|
|
12 };
|
|
13
|
|
14 #define num_eq(num1, num2) (num1.low == num2.low && num1.high == num2.high)
|
|
15
|
|
16 static cpp_num
|
|
17 num_equality_op (lhs, rhs)
|
|
18 cpp_num lhs, rhs;
|
|
19 {
|
|
20 lhs.low = num_eq (lhs, rhs);
|
|
21 lhs.high = 0;
|
|
22 lhs.overflow = 0;
|
|
23 return lhs;
|
|
24 }
|
|
25
|
|
26 int main()
|
|
27 {
|
|
28 cpp_num a = { 1, 2 };
|
|
29 cpp_num b = { 3, 4 };
|
|
30
|
|
31 cpp_num result = num_equality_op (a, b);
|
|
32 if (result.low)
|
|
33 return 1;
|
|
34
|
|
35 result = num_equality_op (a, a);
|
|
36 if (!result.low)
|
|
37 return 2;
|
|
38
|
|
39 return 0;
|
|
40 }
|