PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 20011008-3.c
blob0f56302c43de8f51eb3381f5db7dd5b3a22a6095
1 /* { dg-add-options stack_size } */
3 extern void exit (int);
4 extern void abort (void);
6 typedef unsigned int u_int32_t;
7 typedef unsigned char u_int8_t;
8 typedef int int32_t;
10 typedef enum {
11 TXNLIST_DELETE,
12 TXNLIST_LSN,
13 TXNLIST_TXNID,
14 TXNLIST_PGNO
15 } db_txnlist_type;
17 struct __db_lsn; typedef struct __db_lsn DB_LSN;
18 struct __db_lsn {
19 u_int32_t file;
20 u_int32_t offset;
22 struct __db_txnlist; typedef struct __db_txnlist DB_TXNLIST;
24 struct __db_txnlist {
25 db_txnlist_type type;
26 struct { struct __db_txnlist *le_next; struct __db_txnlist **le_prev; } links;
27 union {
28 struct {
29 u_int32_t txnid;
30 int32_t generation;
31 int32_t aborted;
32 } t;
33 struct {
36 u_int32_t flags;
37 int32_t fileid;
38 u_int32_t count;
39 char *fname;
40 } d;
41 struct {
42 int32_t ntxns;
43 int32_t maxn;
44 DB_LSN *lsn_array;
45 } l;
46 struct {
47 int32_t nentries;
48 int32_t maxentry;
49 char *fname;
50 int32_t fileid;
51 void *pgno_array;
52 u_int8_t uid[20];
53 } p;
54 } u;
57 int log_compare (const DB_LSN *a, const DB_LSN *b)
59 return 1;
63 int
64 __db_txnlist_lsnadd(int val, DB_TXNLIST *elp, DB_LSN *lsnp, u_int32_t flags)
66 int i;
68 for (i = 0; i < (!(flags & (0x1)) ? 1 : elp->u.l.ntxns); i++)
70 int __j;
71 DB_LSN __tmp;
72 val++;
73 for (__j = 0; __j < elp->u.l.ntxns - 1; __j++)
74 if (log_compare(&elp->u.l.lsn_array[__j], &elp->u.l.lsn_array[__j + 1]) < 0)
76 __tmp = elp->u.l.lsn_array[__j];
77 elp->u.l.lsn_array[__j] = elp->u.l.lsn_array[__j + 1];
78 elp->u.l.lsn_array[__j + 1] = __tmp;
82 *lsnp = elp->u.l.lsn_array[0];
83 return val;
86 #if defined (STACK_SIZE) && STACK_SIZE < 12350
87 #define VLEN (STACK_SIZE/10)
88 #else
89 #define VLEN 1235
90 #endif
92 int main (void)
94 DB_TXNLIST el;
95 DB_LSN lsn, lsn_a[VLEN];
97 el.u.l.ntxns = VLEN-1;
98 el.u.l.lsn_array = lsn_a;
100 if (__db_txnlist_lsnadd (0, &el, &lsn, 0) != 1)
101 abort ();
103 if (__db_txnlist_lsnadd (0, &el, &lsn, 1) != VLEN-1)
104 abort ();
106 exit (0);