OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [990628-1.c] - Blame information for rev 774

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 688 jeremybenn
#include <stdlib.h>
2
 
3
struct {
4
    long sqlcode;
5
} sqlca;
6
 
7
 
8
struct data_record {
9
    int dummy;
10
    int a[100];
11
} *data_ptr, data_tmp;
12
 
13
 
14
int
15
num_records()
16
{
17
    return 1;
18
}
19
 
20
 
21
void
22
fetch()
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
 
31
void
32
load_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
 
48
main()
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
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.