Misaligned data (on sparcs)
Phil Prentice
philp.cheer@btinternet.com
Thu Apr 15 19:35:00 GMT 2004
Hi
I am using gcc3.3.3 and have a problem of misaligned integers on sparcs
(solaris). If I use gcc to compile a program that access an integer address
which is not on a 4-byte boundary e.g.
{
chat fred[10];
int *ptr;
ptr = (int *) &fred[2];
printf("*ptr = %d\n",*ptr);
}
The program crashes with a bus error. When I looked at the native compiler
already on the system it has the flag -misalign which enables the program to
run.
For many reasons I would prefer to use the gnu compiler, is there a gcc
compiler flag that will also give us the same result?
Thanks for your help
Phil
More information about the Gcc-help
mailing list