This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: ALIGNMENT/ please reply!!!
- To: help-gcc at gnu dot org
- Subject: Re: ALIGNMENT/ please reply!!!
- From: Herve Dutter <hdutter at nospam dot com>
- Date: Fri, 07 Jan 2000 14:06:00 GMT
- Newsgroups: gnu.gcc.help
- Organization: Trintech
- References: <83ils0$4if$1@nslave1.tin.it>
- Reply-To: herved at bigfoot dot com
- Xref: wodc7nx0 gnu.gcc.help:2386
hi!
I can see no alignment issue in what you describe, the SPARC processor
is just not able to handle shorts with odd location.
Cheers.
cris wrote:
>
> Guys, i really need help!
>
> i'm reposting my first msg:
>
> hi!
>
> how can i tell gcc to compile my programs using strict-alignment for data
> types?
> if i write smth like this:
>
> void *full_array = malloc(50);
> short *short_p = &(( (char*) full_array)[ N ]);
>
> printf("%hd\n",*short_p);
>
> if N is odd, i get a core dump!
>
> i'm using gcc 2.7.2 on an old sparc2 with SunOs 4.1.3, no way to upgrade the
> os or to get a newer build of gcc.
>
> i've searched in the doc., i've found -m switches regarding alignment for
> ibm machines, but none for sparc ones!
>
> i've also seen a SHORT_ALIGNMENT macro to be defined (gcc-info, "You can
> control compilation driver"), but i don't know WHERE to define it!
>
> please help, reply by email too!
>
> have a nice day :)