On Nov 7, 2007, at 12:46 AM, Duncan Sands wrote:

> Hi Bill, the following testcase shows another problem:
>
> struct A
> {
>   int a[1024];
> };
> void g(struct A *a, struct A *b)
> {
>   *a = *b;
> }
> struct A c;
> int main(void)
> {
>   g(&c, &c);
> }
>
> Note that llvm-gcc generates a memcpy for the *a = *b
> assignment, but it should be memmove since *a and *b
> may be the same (as they are in this case).

While that's nonstandard, it's hard to imagine a memcpy  
implementation that would screw it up.
But they can partially overlap:

struct A { int a[1024]; }
struct B { int x; struct A y; };
union C { struct A x; struct B y; }
void g(struct A* a, struct A* b) { *a = *b; }
union C u;
main(void) { g(&u.x, &u.y.y);

I fixed this for structure return values a while back  (43324) but  
you're right that the problem is more general.

_______________________________________________
llvm-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to