| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-options "-O2" } */ |
| 3 |
|
| 4 |
/* Check that we don't crash when trying to handle masks that don't match the |
| 5 |
width of the original type. */ |
| 6 |
|
| 7 |
#include <stdbool.h> |
| 8 |
|
| 9 |
struct s { |
| 10 |
long long q; |
| 11 |
}; |
| 12 |
|
| 13 |
struct s x1 = { 1 }; |
| 14 |
struct s xm1 = { -1 }; |
| 15 |
struct s x8 = { 8 }; |
| 16 |
struct s x0 = { 0 }; |
| 17 |
|
| 18 |
bool f(struct s *p) |
| 19 |
{ |
| 20 |
int q = (int)p->q; |
| 21 |
return (q < 0) || (q & 7); |
| 22 |
} |
| 23 |
|
| 24 |
int main () |
| 25 |
{ |
| 26 |
if (!f (&x1)) |
| 27 |
__builtin_abort (); |
| 28 |
if (!f (&xm1)) |
| 29 |
__builtin_abort (); |
| 30 |
if (f (&x8)) |
| 31 |
__builtin_abort (); |
| 32 |
if (f (&x0)) |
| 33 |
__builtin_abort (); |
| 34 |
return 0; |
| 35 |
} |