This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
bus error in sparc ultra 10 solaris 8 g++ 2.95 3.0
- From: agustin <asanchez at datatec-ec dot com>
- To: "'help-gcc at gnu dot org'" <help-gcc at gnu dot org>
- Date: Tue, 20 Nov 2001 09:37:58 -0500
- Subject: 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.