Fix warning with -Wsign-compare -Wsystem-headers
[official-gcc.git] / gcc / testsuite / gcc.dg / tm / alias-1.c
blob86b3d7ab0ef88c6f269fed1c94d22044943c8cf1
1 /* { dg-do compile } */
2 /* { dg-options "-fgnu-tm -fdump-tree-ealias -O" } */
4 typedef __UINTPTR_TYPE__ ptrcast;
6 #if (__SIZEOF_POINTER__ == 4)
7 #define TM_LOAD __builtin__ITM_RU4
8 #define TM_STORE __builtin__ITM_WU4
9 #elif (__SIZEOF_POINTER__ == 8)
10 #define TM_LOAD __builtin__ITM_RU8
11 #define TM_STORE __builtin__ITM_WU8
12 #else
13 #error Add target support here
14 #endif
16 struct mystruct_type {
17 ptrcast *ptr;
18 } *mystruct;
20 ptrcast *someptr, **pp;
21 ptrcast ui;
23 void f(void)
25 __transaction_atomic {
26 ui = TM_LOAD (&mystruct);
27 mystruct = (struct mystruct_type *) ui;
28 ui = TM_LOAD (&someptr);
29 someptr = (ptrcast *) ui;
30 ui = (ptrcast) someptr;
31 pp = &mystruct->ptr;
32 TM_STORE (pp, ui);
36 /* { dg-final { scan-tree-dump-times "mystruct = \{ .*ESCAPED" 1 "ealias" } } */
37 /* { dg-final { scan-tree-dump-times "someptr = .*same as mystruct" 1 "ealias" } } */
38 /* { dg-final { scan-tree-dump-times "ui\..* = .*same as mystruct" 1 "ealias" } } */
39 /* { dg-final { scan-tree-dump-times "pp\..* = .*same as mystruct" 1 "ealias" } } */