c++: adjust some tests for modules
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 990628-1.c
blobd6f65686c5132714ca04aa89d1f236c279110084
1 #include <stdlib.h>
3 struct {
4 long sqlcode;
5 } sqlca;
8 struct data_record {
9 int dummy;
10 int a[100];
11 } *data_ptr, data_tmp;
14 int
15 num_records()
17 return 1;
21 void
22 fetch()
24 static int fetch_count;
26 __builtin_memset(&data_tmp, 0x55, sizeof(data_tmp));
27 sqlca.sqlcode = (++fetch_count > 1 ? 100 : 0);
31 void
32 load_data() {
33 struct data_record *p;
34 int num = num_records();
36 data_ptr = malloc(num * sizeof(struct data_record));
37 __builtin_memset(data_ptr, 0xaa, num * sizeof(struct data_record));
39 fetch();
40 p = data_ptr;
41 while (sqlca.sqlcode == 0) {
42 *p++ = data_tmp;
43 fetch();
47 int
48 main(void)
50 load_data();
51 if (sizeof (int) == 2 && data_ptr[0].dummy != 0x5555)
52 abort ();
53 else if (sizeof (int) > 2 && data_ptr[0].dummy != 0x55555555)
54 abort ();
55 exit (0);