Re: [PATCH] Help compiler detect invalid code

2019-10-16 Thread François Dumont
Here is a version with __detail::__copy and __detail::__copy_backward. I prefered to introduce the __detail namespace cause __copy is quite a common name so putting it in __detail namespace will I hope clarify that it is for internal usage only. I even hesitated to put more details into this

Re: [PATCH] Help compiler detect invalid code

2019-10-10 Thread Jonathan Wakely
On 01/10/19 22:05 +0200, François Dumont wrote: On 9/27/19 1:24 PM, Jonathan Wakely wrote: On 20/09/19 07:08 +0200, François Dumont wrote: I already realized that previous patch will be too controversial to be accepted. In this new version I just implement a real memmove in __memmove so A

Re: [PATCH] Help compiler detect invalid code

2019-10-01 Thread François Dumont
On 9/27/19 1:24 PM, Jonathan Wakely wrote: On 20/09/19 07:08 +0200, François Dumont wrote: I already realized that previous patch will be too controversial to be accepted. In this new version I just implement a real memmove in __memmove so A real memmove doesn't just work backwards, it

Re: [PATCH] Help compiler detect invalid code

2019-09-27 Thread Jonathan Wakely
On 27/09/19 18:24 +0200, François Dumont wrote: On 9/27/19 2:11 PM, Jonathan Wakely wrote: On 19/09/19 22:27 +0200, François Dumont wrote: Hi     I start working on making recently added constexpr tests to work in Debug mode. The attached patch seems to be necessary for that, right? On

Re: [PATCH] Help compiler detect invalid code

2019-09-27 Thread François Dumont
On 9/27/19 2:11 PM, Jonathan Wakely wrote: On 19/09/19 22:27 +0200, François Dumont wrote: Hi     I start working on making recently added constexpr tests to work in Debug mode. The attached patch seems to be necessary for that, right? On my side I had done this, almost the same. For

Re: [PATCH] Help compiler detect invalid code

2019-09-27 Thread Jonathan Wakely
On 19/09/19 22:27 +0200, François Dumont wrote: Hi     I start working on making recently added constexpr tests to work in Debug mode. The attached patch seems to be necessary for that, right? commit c47326afadb0c330c19b872d5969d2f656499d0a Author: Jonathan Wakely Date: Thu Sep 26

Re: [PATCH] Help compiler detect invalid code

2019-09-27 Thread Jonathan Wakely
On 20/09/19 07:08 +0200, François Dumont wrote: I already realized that previous patch will be too controversial to be accepted. In this new version I just implement a real memmove in __memmove so A real memmove doesn't just work backwards, it needs to detect any overlaps and work forwards

Re: [PATCH] Help compiler detect invalid code

2019-09-25 Thread François Dumont
Some more tests have revealed  a small problem in is_sorted test. It was revealed by the Debug mode but not in a clean ways so for the moment I prefer to fix it and I'll add a _neg test when Debug is able to report it correctly. I've also added a _neg test for equal which doesn't need Debug

Re: [PATCH] Help compiler detect invalid code

2019-09-19 Thread François Dumont
I already realized that previous patch will be too controversial to be accepted. In this new version I just implement a real memmove in __memmove so that in copy_backward there is no need for a shortcut to a more defensive code. I'll see if in Debug mode I can do something. François On

[PATCH] Help compiler detect invalid code

2019-09-19 Thread François Dumont
Hi     I start working on making recently added constexpr tests to work in Debug mode.     It appears that the compiler is able to detect code mistakes pretty well as long we don't try to hide the code intention with a defensive approach. This is why I'd like to propose to replace '__n > 0'