[Ffmpeg-devel] [PATCH] avoid useless memcpy with src==dst (valgrind complains)
Sun Jul 23 20:11:47 CEST 2006
On Sun, Jul 23, 2006 at 05:35:59PM +0200, Reimar D?ffinger wrote:
> On Sun, Jul 23, 2006 at 02:24:17PM -0000, Wolfram Gloger wrote:
> > > Though for src == dst I doubt any memcpy function will break
> > > stuff. And for the overlapping case when src != dst does the C standard
> > > specify the behaviour?
> > Using memcpy() on overlapping objects is undefined behaviour
> > (22.214.171.124#2).
> Which part were you replying to? If to the first: memcpy may strictly
> speaking have undefined behaviour for src == dst, but I very much doubt
> it has in reality.
> If to the second part: I meant if you have two "struct something"
> pointers a and b, is the behaviour of *a = *b defined when the areas for
> *a and *b overlap?
That's an interesting question. *a = *b may be undefined when a and b
both point to the same object; I'm not sure. Anyone care to dig up
> objdump -S on utils.o gives me:
> temp= *buf;
> 18a: ba 58 00 00 00 mov $0x58,%edx
> 18f: 48 89 ee mov %rbp,%rsi
> 192: 48 89 e7 mov %rsp,%rdi
> 195: e8 00 00 00 00 callq 19a <avcodec_default_release_buffer+0x7a>
> *buf= *last;
> 19a: ba 58 00 00 00 mov $0x58,%edx
> 19f: 4c 89 e6 mov %r12,%rsi
> so there definitly is some placeholder for some call...
Use the -r or -R option to see the relocation information; then you
should see where the call goes.
More information about the ffmpeg-devel