Misaligned data (on sparcs)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux