[uClibc 0005464]: Memcpy forward copy breaks with unaligned transfers in memcpy(ARM)

bugs at busybox.net bugs at busybox.net
Fri Oct 17 12:26:25 UTC 2008


The following issue has been SUBMITTED. 
====================================================================== 
http://busybox.net/bugs/view.php?id=5464 
====================================================================== 
Reported By:                upakul
Assigned To:                uClibc
====================================================================== 
Project:                    uClibc
Issue ID:                   5464
Category:                   Architecture Specific
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             10-17-2008 05:26 PDT
Last Modified:              10-17-2008 05:26 PDT
====================================================================== 
Summary:                    Memcpy forward copy breaks with unaligned transfers
in memcpy(ARM)
Description: 
Hi all,

The issue observed is that if we try to do unaligned transfers in the case
of forward copy it raises an error. However everything works fine in the
case of backward copy. 

To reproduce write a simple program like:

#include <stdio.h>
#include <string.h>
#include <sys/time.h>

static volatile char dst[4*1024*1024+64],src[4*1024*1024+64];

int main(int argc, char **argv)
{
   int i, count=atoi(argv[2]);
   char *newsrc = (char *)( ( ( ((int)&src[31])/32 )*32) +
atoi(argv[1]));
   char *newdst = (char *)( ( ( ((int)&dst[31])/32 )*32) +
atoi(argv[1]));
   memset(newsrc,'A',4194304); 
   memset(newdst,'B',4194304); 
   for (i=0;i<count;i++)
   {
     memcpy(newdst, newsrc, 4194304);
   }
   return 0;
}

Where argv[1] is the alignment. It will throw error if alignment is 1,3
and so on... However the same thing works fine in the case of backward
copy[To perform a backward copy, declare the buffers as static volatile
char src[4*1024*1024+64], dst[4*1024*1024+64];]
====================================================================== 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
10-17-08 05:26  upakul         New Issue                                    
10-17-08 05:26  upakul         Status                   new => assigned     
10-17-08 05:26  upakul         Assigned To               => uClibc          
======================================================================




More information about the uClibc-cvs mailing list