source: trunk/src/gcc/gcc/testsuite/gcc.c-torture/execute/990628-1.c@ 2

Last change on this file since 2 was 2, checked in by bird, 22 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 830 bytes
Line 
1#include <stdlib.h>
2
3struct {
4 long sqlcode;
5} sqlca;
6
7
8struct data_record {
9 int dummy;
10 int a[100];
11} *data_ptr, data_tmp;
12
13
14int
15num_records()
16{
17 return 1;
18}
19
20
21void
22fetch()
23{
24 static int fetch_count;
25
26 memset(&data_tmp, 0x55, sizeof(data_tmp));
27 sqlca.sqlcode = (++fetch_count > 1 ? 100 : 0);
28}
29
30
31void
32load_data() {
33 struct data_record *p;
34 int num = num_records();
35
36 data_ptr = malloc(num * sizeof(struct data_record));
37 memset(data_ptr, 0xaa, num * sizeof(struct data_record));
38
39 fetch();
40 p = data_ptr;
41 while (sqlca.sqlcode == 0) {
42 *p++ = data_tmp;
43 fetch();
44 }
45}
46
47
48main()
49{
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);
56}
Note: See TracBrowser for help on using the repository browser.