]>
Commit | Line | Data |
---|---|---|
a092753f AF |
1 | Index: fold-const.c |
2 | =================================================================== | |
3 | *** gcc4.0.3/gcc/fold-const.c (revision 114755) | |
4 | --- gcc4.0.3/fold-const.c (working copy) | |
5 | *************** operand_equal_p (tree arg0, tree arg1, u | |
6 | *** 2497,2502 **** | |
7 | --- 2497,2507 ---- | |
8 | if (TYPE_UNSIGNED (TREE_TYPE (arg0)) != TYPE_UNSIGNED (TREE_TYPE (arg1))) | |
9 | return 0; | |
10 | ||
11 | + /* If both types don't have the same precision, then it is not safe | |
12 | + to strip NOPs. */ | |
13 | + if (TYPE_PRECISION (TREE_TYPE (arg0)) != TYPE_PRECISION (TREE_TYPE (arg1))) | |
14 | + return 0; | |
15 | + | |
16 | STRIP_NOPS (arg0); | |
17 | STRIP_NOPS (arg1); | |
18 | ||
19 | ||
20 | ||
21 | /* { dg-do run } */ | |
22 | ||
23 | extern void abort(void); | |
24 | struct a | |
25 | { | |
26 | unsigned int bits : 1; | |
27 | signed long val : ((sizeof(long) * 8) - 1); | |
28 | }; | |
29 | int Fnegate (struct a b) | |
30 | { | |
31 | if ((-((long)b.val)) <= ((long) ((1UL << ((sizeof(long) * 8) - 2)) -1UL)) | |
32 | && (-((long)b.val)) >= (-(((long) ((1UL << ((sizeof(long) * 8) - 2)) -1UL))) - 1)) | |
33 | return 0 ; | |
34 | abort (); | |
35 | } | |
36 | int main () | |
37 | { | |
38 | struct a b = {1, 1}; | |
39 | Fnegate (b); | |
40 | return 0; | |
41 | } |