Re: overlapping strncpy/memcpy errors via valgrind - Mailing list pgsql-hackers

From anarazel@anarazel.de
Subject Re: overlapping strncpy/memcpy errors via valgrind
Date
Msg-id 3f051456-b28a-4dd1-9044-65c7feda392c@email.android.com
Whole thread Raw
In response to Re: overlapping strncpy/memcpy errors via valgrind  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers

Tom Lane <tgl@sss.pgh.pa.us> schrieb:

>Andres Freund <andres@2ndquadrant.com> writes:
>> On 2013-02-17 15:10:35 +0000, Greg Stark wrote:
>>> Peter G is sitting near me and reminded me that this issue came up
>in the
>>> past. Iirc the conclusion then is that we're calling memcpy where
>the
>>> source and destination pointers are sometimes identical. Tom decided
>there
>>> was really no realistic architecture where that wouldn't work.
>
>> I am not so convinced that that is safe if libc turns that into some
>> optimized string instructions or even PCMPSTR...
>
>What would you envision happening that would be bad?

Afair some of the optimized instructions (like movdqa) don't necessarily work if source an target are in the same
location.Not sure about it bit I wouldn't want to depend on it. 

Andres


---
Please excuse brevity and formatting - I am writing this on my mobile phone.



pgsql-hackers by date:

Previous
From: "David E. Wheeler"
Date:
Subject: Re: JSON Function Bike Shedding
Next
From: "anarazel@anarazel.de"
Date:
Subject: Re: overlapping strncpy/memcpy errors via valgrind