This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

bus error in sparc ultra 10 solaris 8 g++ 2.95 3.0


unsigned long x;
> char p[15];
> .
>      strcpy (p, "abcdefghijkl");
>      x = *(unsigned long *)((char *)p + 3);     //   <<<----------------here bus error
> 
> why ??
> this instruction is not standard c ?? and why
> x = *(unsigned long *)((char *)p + 4);    // not failure ???
> 
> i know that can  write
>      memcpy ((char *)&x, (char *)(p+3), sizeof(unsigned long));
> 
> but what happen ??  error in compiler o ????
> thanks for your help.
> Agustin.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]