| 1 |
/* PR rtl-optimization/38245 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O2 -fdump-tree-optimized" } */ |
| 4 |
|
| 5 |
extern void link_error (void); |
| 6 |
|
| 7 |
void |
| 8 |
f1 (unsigned int a) |
| 9 |
{ |
| 10 |
if (a != 28) |
| 11 |
{ |
| 12 |
if (4 / a == 5) |
| 13 |
link_error (); |
| 14 |
} |
| 15 |
} |
| 16 |
|
| 17 |
void |
| 18 |
f2 (unsigned int a) |
| 19 |
{ |
| 20 |
if (4 / a == 5) |
| 21 |
link_error (); |
| 22 |
} |
| 23 |
|
| 24 |
void |
| 25 |
f3 (unsigned int a) |
| 26 |
{ |
| 27 |
if (4 / (a & 0xff) == 5) |
| 28 |
link_error (); |
| 29 |
} |
| 30 |
|
| 31 |
void |
| 32 |
f4 (unsigned int a, unsigned int b) |
| 33 |
{ |
| 34 |
if ((b & 3) / ((a & 0xff) + 1) == 5) |
| 35 |
link_error (); |
| 36 |
} |
| 37 |
|
| 38 |
void |
| 39 |
f5 (int a) |
| 40 |
{ |
| 41 |
if (a != 28) |
| 42 |
{ |
| 43 |
if (4 / a == 5) |
| 44 |
link_error (); |
| 45 |
} |
| 46 |
} |
| 47 |
|
| 48 |
void |
| 49 |
f6 (int a) |
| 50 |
{ |
| 51 |
if (4 / a == 5) |
| 52 |
link_error (); |
| 53 |
} |
| 54 |
|
| 55 |
void |
| 56 |
f7 (int a) |
| 57 |
{ |
| 58 |
if (4 / (a & 0xff) == 5) |
| 59 |
link_error (); |
| 60 |
} |
| 61 |
|
| 62 |
void |
| 63 |
f8 (int a, int b) |
| 64 |
{ |
| 65 |
if ((b & 3) / ((a & 0xff) + 1) == 5) |
| 66 |
link_error (); |
| 67 |
} |
| 68 |
|
| 69 |
void |
| 70 |
f9 (int a, int b) |
| 71 |
{ |
| 72 |
if (b >= 4) |
| 73 |
if ((a / b) == __INT_MAX__ / 2) |
| 74 |
link_error (); |
| 75 |
} |
| 76 |
|
| 77 |
void |
| 78 |
f10 (unsigned int a, unsigned int b) |
| 79 |
{ |
| 80 |
if (b >= 16) |
| 81 |
if ((a / b) == __INT_MAX__ / 4) |
| 82 |
link_error (); |
| 83 |
} |
| 84 |
|
| 85 |
void |
| 86 |
f11 (int a, int b) |
| 87 |
{ |
| 88 |
if (b <= -32) |
| 89 |
if ((a / b) == -__INT_MAX__ / 16) |
| 90 |
link_error (); |
| 91 |
} |
| 92 |
|
| 93 |
void |
| 94 |
f12 (int a, int b) |
| 95 |
{ |
| 96 |
if (a >= -6 && a <= 4) |
| 97 |
if ((a / b) == -7 || (a / b) == 7) |
| 98 |
link_error (); |
| 99 |
} |
| 100 |
|
| 101 |
void |
| 102 |
f13 (unsigned int a, unsigned int b) |
| 103 |
{ |
| 104 |
if (a <= 4) |
| 105 |
if ((a / b) == 5) |
| 106 |
link_error (); |
| 107 |
} |
| 108 |
|
| 109 |
/* { dg-final { scan-tree-dump-not "link_error" "optimized" } } */ |