Tighten condition in vect/pr85586.c (PR 85654)
[official-gcc.git] / gcc / testsuite / gcc.dg / tm / opt-1.c
blob87a8c72bd4337e8782431dd6aee537151219c604
1 /* { dg-do compile } */
2 /* { dg-options "-fgnu-tm -O" } */
4 extern void usleep (int) __attribute__((transaction_pure));
5 extern int rand(void) __attribute__((pure, transaction_pure));
6 extern int printf (const char *, ...);
7 extern void *malloc (__SIZE_TYPE__) __attribute__((malloc));
8 extern void xyzzy (void * (*)(void *));
10 typedef struct
12 int id;
13 } parm;
15 int gvar;
17 void *hello(void *arg)
19 parm *p=(parm *)arg;
20 int tmp = p->id;
21 int tmp3;
22 printf ("Thread reads %d.\n", tmp);
23 __transaction_atomic
25 int tmp2 = gvar;
26 usleep ((int) (10.0*rand()/(10+1.0))/100);
27 gvar = tmp + tmp2;
28 tmp3 = gvar;
30 printf("tmp3 = %d\n", tmp3);
31 return 0;
34 int
35 main()
37 int i, n = rand();
39 for (i=0; i<n; i++)
40 xyzzy (hello);
42 return 0;