This is the mail archive of the gcc-bugs@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]

Re: GCC bug on Linux/Alpha, optimising memcpy()



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.

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