mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-29 15:41:59 +00:00
4caa875442
It turns out that initializing a local int with a pointer cast doesn't work.
36 lines
683 B
R
36 lines
683 B
R
int a;
|
|
double b;
|
|
int c;
|
|
double d;
|
|
void printf (string fmt, ...) = #0;
|
|
|
|
int main()
|
|
{
|
|
int fail = 0;
|
|
void *ap = &a;
|
|
void *bp = &b;
|
|
void *cp = &c;
|
|
void *dp = &d;
|
|
int aa = (int) ap;
|
|
int ba = (int) bp;
|
|
int ca = (int) cp;
|
|
int da = (int) dp;
|
|
|
|
if (ba & 1) {
|
|
printf ("double b is not aligned: %d\n", ba);
|
|
fail |= 1;
|
|
}
|
|
if (da & 1) {
|
|
printf ("double d is not aligned: %d\n", da);
|
|
fail |= 1;
|
|
}
|
|
if (ca - aa != 1) {
|
|
printf ("int c (%d) is not adjacant to int a (%d)\n", ca, aa);
|
|
fail |= 1;
|
|
}
|
|
if (ba <= ca) {
|
|
printf ("double b does not come after int c: %d %d\n", ba, ca);
|
|
fail |= 1;
|
|
}
|
|
return fail;
|
|
}
|