URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 149 |
Rev 154 |
void f (int *p, int **q)
|
void f (int *p, int **q)
|
{
|
{
|
int i;
|
int i;
|
for (i = 0; i < 40; i++)
|
for (i = 0; i < 40; i++)
|
{
|
{
|
*q++ = &p[i];
|
*q++ = &p[i];
|
}
|
}
|
}
|
}
|
|
|
int main ()
|
int main ()
|
{
|
{
|
void *p;
|
void *p;
|
int *q[40];
|
int *q[40];
|
__SIZE_TYPE__ start;
|
__SIZE_TYPE__ start;
|
|
|
/* Find the signed middle of the address space. */
|
/* Find the signed middle of the address space. */
|
if (sizeof(start) == sizeof(int))
|
if (sizeof(start) == sizeof(int))
|
start = (__SIZE_TYPE__) __INT_MAX__;
|
start = (__SIZE_TYPE__) __INT_MAX__;
|
else if (sizeof(start) == sizeof(long))
|
else if (sizeof(start) == sizeof(long))
|
start = (__SIZE_TYPE__) __LONG_MAX__;
|
start = (__SIZE_TYPE__) __LONG_MAX__;
|
else if (sizeof(start) == sizeof(long long))
|
else if (sizeof(start) == sizeof(long long))
|
start = (__SIZE_TYPE__) __LONG_LONG_MAX__;
|
start = (__SIZE_TYPE__) __LONG_LONG_MAX__;
|
else
|
else
|
return 0;
|
return 0;
|
|
|
/* Arbitrarily align the pointer. */
|
/* Arbitrarily align the pointer. */
|
start &= -32;
|
start &= -32;
|
|
|
/* Pretend that's good enough to start address arithmetic. */
|
/* Pretend that's good enough to start address arithmetic. */
|
p = (void *)start;
|
p = (void *)start;
|
|
|
/* Verify that GIV replacement computes the correct results. */
|
/* Verify that GIV replacement computes the correct results. */
|
q[39] = 0;
|
q[39] = 0;
|
f (p, q);
|
f (p, q);
|
if (q[39] != (int *)p + 39)
|
if (q[39] != (int *)p + 39)
|
abort ();
|
abort ();
|
|
|
return 0;
|
return 0;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.