This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: GCC bug on Linux/Alpha, optimising memcpy()
- To: Jan Wielemaker <jan at swi dot psy dot uva dot nl>
- Subject: Re: GCC bug on Linux/Alpha, optimising memcpy()
- From: Martin Kahlert <martin dot kahlert at mchp dot siemens dot de>
- Date: Tue, 22 Feb 2000 12:14:32 +0100
- Cc: gcc-bugs at gcc dot gnu dot org
- References: <00022211594803.20611@gollem>
- Reply-To: martin dot kahlert at mchp dot siemens dot de
It seems, that your problem is fixed in gcc 2.95.2
since, i can't reproduce it here.
Martin.
Quoting Jan Wielemaker (jan@swi.psy.uva.nl):
> Hi,
>
> Please find the problem with description in the file below. I think
> the two different answers clearly exhibit the problem. This is a
> minimalised version from a big program I used to make sure it wasn't
> my fault.
>
> Thanks for gcc
>
> Regards --- Jan
>
> /* gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
> Linux thor 2.2.13 #1 Sun Nov 28 23:57:27 GMT 1999 alpha unknown
>
> Demonstrate:
> gcc -O2 -DBUG gccbug.c
> ./a.out
> 3400000000000000
> gcc -O2 gccbug.c
> ./a.out
> 3412000000000000
> */
>
> #include <stdio.h>
> #include <string.h>
>
> typedef unsigned long word;
> typedef word atom_t;
>
> #ifdef BUG
> #define to p
> #else
> #define to buf
> #endif
>
> int
> main(int argc, char **argv)
> { char buf[1000];
> char *p = buf;
> word w = 0x1234;
> int i;
>
> memcpy(to, (char *)&w, sizeof(atom_t));
>
> for(i=0; i<sizeof(word); i++)
> printf("%02x", to[i]&0xff);
> printf("\n");
>
> return 0;
> }
--
The early bird gets the worm. If you want something else for
breakfast, get up later.