{"action":"created","issue":{"url":"https://api.github.com/repos/numpy/numpy/issues/7468","repository_url":"https://api.github.com/repos/numpy/numpy","labels_url":"https://api.github.com/repos/numpy/numpy/issues/7468/labels{/name}","comments_url":"https://api.github.com/repos/numpy/numpy/issues/7468/comments","events_url":"https://api.github.com/repos/numpy/numpy/issues/7468/events","html_url":"https://github.com/numpy/numpy/pull/7468","id":143791784,"number":7468,"title":"BUG: more on inplace reductions, fixes #615","user":{"login":"jaimefrio","id":3343990,"avatar_url":"https://avatars.githubusercontent.com/u/3343990?v=3","gravatar_id":"","url":"https://api.github.com/users/jaimefrio","html_url":"https://github.com/jaimefrio","followers_url":"https://api.github.com/users/jaimefrio/followers","following_url":"https://api.github.com/users/jaimefrio/following{/other_user}","gists_url":"https://api.github.com/users/jaimefrio/gists{/gist_id}","starred_url":"https://api.github.com/users/jaimefrio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaimefrio/subscriptions","organizations_url":"https://api.github.com/users/jaimefrio/orgs","repos_url":"https://api.github.com/users/jaimefrio/repos","events_url":"https://api.github.com/users/jaimefrio/events{/privacy}","received_events_url":"https://api.github.com/users/jaimefrio/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/numpy/numpy/labels/11%20-%20Bug","name":"11 - Bug","color":"fef2c0"},{"url":"https://api.github.com/repos/numpy/numpy/labels/component:%20numpy.core","name":"component: numpy.core","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2016-03-27T09:26:22Z","updated_at":"2016-03-28T18:37:25Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/numpy/numpy/pulls/7468","html_url":"https://github.com/numpy/numpy/pull/7468","diff_url":"https://github.com/numpy/numpy/pull/7468.diff","patch_url":"https://github.com/numpy/numpy/pull/7468.patch"},"body":"This is a follow up to #7407 and #7466. It fixes an error in the\r\ncomments (0 is the output and 1 is the input), moves them around so\r\nthey apply to both branches of the if/else, and changes memcpy to\r\nmemmove, since the memory segments can be overlapping, as pointed\r\nout by Valgrind in a really old issue."},"comment":{"url":"https://api.github.com/repos/numpy/numpy/issues/comments/202522426","html_url":"https://github.com/numpy/numpy/pull/7468#issuecomment-202522426","issue_url":"https://api.github.com/repos/numpy/numpy/issues/7468","id":202522426,"user":{"login":"jaimefrio","id":3343990,"avatar_url":"https://avatars.githubusercontent.com/u/3343990?v=3","gravatar_id":"","url":"https://api.github.com/users/jaimefrio","html_url":"https://github.com/jaimefrio","followers_url":"https://api.github.com/users/jaimefrio/followers","following_url":"https://api.github.com/users/jaimefrio/following{/other_user}","gists_url":"https://api.github.com/users/jaimefrio/gists{/gist_id}","starred_url":"https://api.github.com/users/jaimefrio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaimefrio/subscriptions","organizations_url":"https://api.github.com/users/jaimefrio/orgs","repos_url":"https://api.github.com/users/jaimefrio/repos","events_url":"https://api.github.com/users/jaimefrio/events{/privacy}","received_events_url":"https://api.github.com/users/jaimefrio/received_events","type":"User","site_admin":false},"created_at":"2016-03-28T18:37:25Z","updated_at":"2016-03-28T18:37:25Z","body":"I have not been able to find an example where `memcpy` vs `memmove` actually makes a difference. I was hoping that something like this:\r\n\r\n```Python\r\n>>> a = np.arange(6, dtype=np.double)\r\n>>> b = a.view(np.complex128)\r\n>>> c = a[1:3].view(np.complex128)\r\n>>> np.add.reduceat(b, [0], out=c)\r\narray([ 6.0+9.0j], dtype=complex128)\r\n```\r\n\r\nwould do it, but as shown above it produces the correct result: it seems that we ask for 128 bit alignment for complex128, so that the destination array is update-if-copied, or I have no way of explaining why it is working. If I use `longdouble` and `complex256` in the same example I at least get to see the overwriting of the first output affecting the result, i.e. the result is `5 + 9j`, but not the expected effect of a naive memcpy, i.e. a `5 + 8j` result.\r\n\r\nSo I guess this whole thing is more about \"doing the right thing\" than fixing any real issues: modern compilers/libraries seem to do a nice job of not letting you hurt yourself in the most stupid of ways."}}