111
|
1 /* { dg-do run { target { stdint_types } } } */
|
|
2 /* { dg-options "-O2" } */
|
|
3
|
|
4 #include <stdint.h>
|
|
5 #include <stdlib.h>
|
|
6
|
|
7 void __attribute__ ((noinline))
|
|
8 foo (uint64_t state, uint32_t last)
|
|
9 {
|
|
10 if (state == last) abort ();
|
|
11 }
|
|
12
|
|
13 /* This function may do a bad comparision by trying to
|
|
14 use SUBREGS during the compare on machines where comparing
|
|
15 two registers always compares the entire register regardless
|
|
16 of mode. */
|
|
17
|
|
18 int __attribute__ ((noinline))
|
|
19 compare (uint64_t state, uint32_t *last, uint8_t buf)
|
|
20 {
|
|
21 if (*last == ((state | buf) & 0xFFFFFFFF)) {
|
|
22 foo (state, *last);
|
|
23 return 0;
|
|
24 }
|
|
25 return 1;
|
|
26 }
|
|
27
|
|
28 int
|
|
29 main(int argc, char **argv) {
|
|
30 uint64_t state = 0xF00000100U;
|
|
31 uint32_t last = 0x101U;
|
|
32 int ret = compare(state, &last, 0x01);
|
|
33 if (ret != 0)
|
|
34 abort ();
|
|
35 exit (0);
|
|
36 }
|