public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Misaligned data (on sparcs)
@ 2004-04-15 19:35 Phil Prentice
  0 siblings, 0 replies; only message in thread
From: Phil Prentice @ 2004-04-15 19:35 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2004-04-15 19:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-15 19:35 Misaligned data (on sparcs) Phil Prentice

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).