<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Aug 7, 2016 at 6:21 AM, Furkan Usta via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I guess, I've found 2 bugs. I am not sure whether I should send this 2 separate mails. It is my first time, sorry about that.<div><br></div><div>1-) Custom allocator with explicit copy constructor</div><div>Here is the non-working code: <a href="http://melpon.org/wandbox/permlink/wPpkYEzt0NrxTbJC" target="_blank">http://melpon.org/<wbr>wandbox/permlink/<wbr>wPpkYEzt0NrxTbJC</a></div><div><br></div><div>My reasoning is, in map constructor</div><div><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap">map(const allocator_type& __a)
        : __tree_(__a)</pre><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap">__a is an allocator with std::pair. However, __tree_ is instantiated with <span style="font-family:arial,sans-serif">__value_type. It requires copy construction which is explicit.</span></pre><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap"><br></pre><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap"><br></pre><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap">2-) operator=, <span style="font-family:DejaVuSansMono,"DejaVu Sans Mono",courier,monospace;font-size:12.8px;line-height:15.36px">propagate_on_container_copy_<wbr>assignment</span></pre><pre style="word-wrap:break-word"><span style="color:rgb(0,0,0);white-space:pre-wrap;font-family:DejaVuSansMono,"DejaVu Sans Mono",courier,monospace;font-size:12.8px;line-height:15.36px">Code: </span><font color="#000000" face="DejaVuSansMono, DejaVu Sans Mono, courier, monospace"><span style="font-size:12.8px;line-height:15.36px;white-space:pre-wrap"><a href="http://melpon.org/wandbox/permlink/uPR3u5fYkUx2In4k" target="_blank">http://melpon.org/wandbox/<wbr>permlink/uPR3u5fYkUx2In4k</a></span></font></pre><pre style="word-wrap:break-word"><font color="#000000" face="DejaVuSansMono, DejaVu Sans Mono, courier, monospace"><span style="font-size:12.8px;line-height:15.36px;white-space:pre-wrap">propagate_on_container_copy_<wbr>assignment is true and comparison always returns false. Thus, it should use this->allocator to deallocate and other.allocator to allocate. </span></font></pre><pre style="word-wrap:break-word">Although in the example it doesn't even allocate, I guess it is because <span style="font-family:arial,sans-serif">there is </span></pre><pre style="word-wrap:break-word"><span style="font-family:arial,sans-serif">some sort of caching system, in the code it does</span></pre><pre style="color:rgb(0,0,0);word-wrap:break-word;white-space:pre-wrap">__copy_assign_alloc(__t);
</pre><pre style="word-wrap:break-word"><span style="color:rgb(0,0,0);white-space:pre-wrap;font-family:arial,sans-serif">__assign_multi(__t.begin(), __t.end());</span><span style="font-family:arial,sans-serif"> </span></pre><pre style="word-wrap:break-word"><span style="font-family:arial,sans-serif">Then caches the nodes to be deleted in __assign_multi, but allocator already changes </span></pre><pre style="word-wrap:break-word"><span style="font-family:arial,sans-serif">in __copy_assign_alloc</span></pre><pre style="word-wrap:break-word"><span style="font-family:arial,sans-serif"><br></span></pre><pre style="word-wrap:break-word"><span style="font-family:arial,sans-serif">If they are really bugs, should I still open an issue in bugzilla or is this mail enough?</span></pre><pre style="word-wrap:break-word"><span style="font-family:arial,sans-serif"><br></span></pre></div></div></blockquote><div>I would appreciate it if you would open them on <a href="http://llvm.org/bugs">http://llvm.org/bugs</a> </div><div>Thanks!</div><div><br></div><div>-- Marshall</div><div> </div></div><br></div></div>