Handle symbol visibility/locality for PIE/PIC
[official-gcc.git] / gcc / testsuite / c-c++-common / tm / safe-1.c
blobb2a43530575859513afa90ef4555a2a1d5c398af
1 /* { dg-do compile } */
2 /* { dg-options "-fgnu-tm" } */
4 void ts(void) __attribute__((transaction_safe));
5 void tp(void) __attribute__((transaction_pure));
6 void tc(void) __attribute__((transaction_callable));
7 void ti(void) __attribute__((transaction_unsafe));
8 void tm(void) __attribute__((transaction_may_cancel_outer));
9 void tu(void);
10 int fc(int) __attribute__((const));
12 typedef void (*Fs) (void) __attribute__((transaction_safe));
13 typedef void (*Fc) (void) __attribute__((transaction_callable));
14 typedef void (*Fi) (void) __attribute__((transaction_unsafe));
15 typedef void (*Fm) (void) __attribute__((transaction_may_cancel_outer));
16 extern Fs ps;
17 extern Fc pc;
18 extern Fi pi;
19 extern Fm pm;
20 extern void (*pu)(void);
22 int __attribute__((transaction_safe))
23 foo(void)
25 int i;
27 ts();
28 tp();
29 tc(); /* { dg-error "unsafe function call" } */
30 ti(); /* { dg-error "unsafe function call" } */
32 /* ??? Direct function calls without markups are handled later
33 than pass_diagnose_tm_blocks, which means we'll exit with
34 errors before getting there. This test moved to safe-3.c. */
35 /* tu(); */
37 (*ps)();
38 (*pc)(); /* { dg-error "unsafe function call" } */
39 (*pi)(); /* { dg-error "unsafe function call" } */
40 (*pu)(); /* { dg-error "unsafe function call" } */
42 asm(""); /* { dg-error "asm not allowed" } */
43 asm("" : "=g"(i)); /* { dg-error "asm not allowed" } */
45 return fc(i);
48 int __attribute__((transaction_may_cancel_outer))
49 bar(void)
51 int i;
53 ts();
54 tp();
55 tc(); /* { dg-error "unsafe function call" } */
56 ti(); /* { dg-error "unsafe function call" } */
57 tm();
59 (*ps)();
60 (*pc)(); /* { dg-error "unsafe function call" } */
61 (*pi)(); /* { dg-error "unsafe function call" } */
62 (*pm)();
63 (*pu)(); /* { dg-error "unsafe function call" } */
65 asm(""); /* { dg-error "asm not allowed" } */
66 asm("" : "=g"(i)); /* { dg-error "asm not allowed" } */
68 return fc(i);