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

bug fix for testsuite/gcc.c-torture/execute/memcpy-1.c


gcc.c-torture/execute/memcpy-1.c is not 16-bit-int clean.
Here is a fix:

Thu Jan 25 01:19:22 2001  J"orn Rennecke <amylaar@redhat.com>

	* gcc.c-torture/execute/memcpy-1.c (MEMCPY_SIZE): Use sizeof char.
	(ptrdiff_t): Define.
	(copy, main): Use it.

Index: gcc.c-torture/execute/memcpy-1.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/testsuite/gcc.c-torture/execute/memcpy-1.c,v
retrieving revision 1.13
diff -p -r1.13 memcpy-1.c
*** memcpy-1.c	1998/11/11 05:57:01	1.13
--- memcpy-1.c	2001/01/25 01:19:20
***************
*** 1,20 ****
  #include <string.h>
  
  #if defined (STACK_SIZE)
  #define MEMCPY_SIZE (STACK_SIZE / 3)
  #else
! #define MEMCPY_SIZE (1 << 17)
  #endif
  
  
! void *copy (void *o, const void *i, unsigned l)
  {
    return memcpy (o, i, l);
  }
  
  main ()
  {
!   unsigned i;
    unsigned char src[MEMCPY_SIZE];
    unsigned char dst[MEMCPY_SIZE];
  
--- 1,26 ----
  #include <string.h>
  
+ #if __INT_MAX__ == 32767
+ #define ptrdiff_t long
+ #else
+ #define ptrdiff_t int
+ #endif
+ 
  #if defined (STACK_SIZE)
  #define MEMCPY_SIZE (STACK_SIZE / 3)
  #else
! #define MEMCPY_SIZE (sizeof (char) << 17)
  #endif
  
  
! void *copy (void *o, const void *i, unsigned ptrdiff_t l)
  {
    return memcpy (o, i, l);
  }
  
  main ()
  {
!   ptrdiff_t i;
    unsigned char src[MEMCPY_SIZE];
    unsigned char dst[MEMCPY_SIZE];
  

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