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] - Rev 774

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

#include <stdlib.h>
 
struct {
    long sqlcode;
} sqlca;
 
 
struct data_record {
    int dummy;
    int a[100];
} *data_ptr, data_tmp;
 
 
int
num_records()
{
    return 1;
}
 
 
void
fetch()
{
    static int fetch_count;
 
    memset(&data_tmp, 0x55, sizeof(data_tmp));
    sqlca.sqlcode = (++fetch_count > 1 ? 100 : 0);
}
 
 
void
load_data() {
    struct data_record *p;
    int num = num_records();
 
    data_ptr = malloc(num * sizeof(struct data_record));
    memset(data_ptr, 0xaa, num * sizeof(struct data_record));
 
    fetch();
    p = data_ptr;
    while (sqlca.sqlcode == 0) {
        *p++ = data_tmp;
        fetch();
    }
}
 
 
main()
{
    load_data();
    if (sizeof (int) == 2 && data_ptr[0].dummy != 0x5555)
      abort ();
    else if (sizeof (int) > 2 && data_ptr[0].dummy != 0x55555555)
      abort ();
    exit (0);
}
 

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

powered by: WebSVN 2.1.0

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