[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: Zip problems (Re: (no subject))
From: Denys Duchier <duchier () ps ! uni-sb ! de>
Date: 2002-11-18 11:22:03
[Download RAW message or body]
david@mandrakesoft.com (David Faure) writes:
>> The fix is to change a memcpy by a qmemmove. However, I do not understand why
>> it would be necessary in that case. (Gcc 3.2 bug?)
>
> From "man memcpy" :
> The memory areas may not overlap. Use memmove(3) if the memory areas do overlap.
>
> This can be the only reason.
no, this is not the reason. the areas do not overlap. however, there
is clearly a bug in gcc. when optimizing, it inlines memcpy for small
sized args, and screws up. This can be easily checked with a simple
program:
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
char* buffer = new char[8];
const char head[] = {
'A', 'B', 'C', 'D',
'E', 'F', 'G', 'H'
};
asm("foo:");
memcpy(buffer,head,sizeof(head));
asm("baz:");
for(int i=0;i<8;i++)
cout << "[" << i << "] = " << head[i] << " , " << buffer[i] << endl;
return 0;
}
when compiled with optimizations, this prints out the following for
me:
["foo" (application/octet-stream)]
I am going to ask on the gcc list about this.
Cheers,
PS: david, I am cc'ing to you as my email doesn't seem to make to the list
--Denys
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic