Skip to content
Snippets Groups Projects
Commit 0819ccfb authored by law's avatar law
Browse files

Opps. Wrong file the first time.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@27813 138bc75d-0d04-0410-961f-82ee72b054a4
parent 0acd1f66
No related branches found
No related tags found
No related merge requests found
#define TP_BSIZE 64
#include <stdlib.h>
char buf[2*TP_BSIZE];
char (*nextblock)[TP_BSIZE] = (char (*)[TP_BSIZE]) buf;
struct {
long sqlcode;
} sqlca;
union u_test {
char dummy[TP_BSIZE];
struct s_test {
int a;
int b;
int c;
} s_test;
};
main(int argc, char **argv)
struct data_record {
int dummy;
int a[100];
} *data_ptr, data_tmp;
int
num_records()
{
int i;
char dp[TP_BSIZE];
return 1;
}
for (i = 0; i < 2*TP_BSIZE; i++)
buf[i] = '.';
for (i = 0; i < TP_BSIZE; i++)
dp[i] = 'a';
void
fetch()
{
static int fetch_count;
memset(&data_tmp, 0x55, sizeof(data_tmp));
sqlca.sqlcode = (++fetch_count > 1 ? 100 : 0);
}
*(union u_test *)(*(nextblock)++) = *(union u_test *)dp;
for (i = 0; i < 2*TP_BSIZE; i++)
printf("%c%s", buf[i], (i % 64) == 63 ? "\n" : "");
exit(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 (data_ptr[0].dummy != 0x55555555)
abort ();
exit (0);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment