================
Comment at: include/vector:1029
@@ -1034,1 +1028,3 @@
+    __alloc_traits::__construct_range_forward(__a, __first, __last, 
this->__end_);
+    __annotator.__done();
 }
----------------
EricWF wrote:
> mclow.lists wrote:
> > This is not exception safe.
> > If one of the constructions throws, then the ASAN annotations will be wrong.
> > 
> This actually is exception safe but I had to think about it for a long time 
> before I understood. 
> 
> 1. `__RAII_IncreaseAnnotate __annotator(*this, __n);`: Unpoison the next __n 
> elements.
> 2. `__annotator.__done()`. commits to unpoisoning the elements.
> 3. `~__annotator`: If `__done()` has been called the destructor does nothing. 
> Otherwise it re-poisons everything from __end_ on.
> 
I don't think that's right - but I think that the problem is in 
`__RAII_IncreaseAnnotate`, not here.  

`__annotate_shrink` needs the old size to reset the poisoned area, but it's 
passing `size() + __n`, where `__n` is the sized that was originally grown. 
This works fine as long as we're only increasing by 1 element, and failure 
means "no change" to the size. However, now that we're increasing by >1, we 
have to deal with the idea that failure can still change the size. 

One possible way of fixing this is to change  `__RAII_IncreaseAnnotator` so 
that instead of saving off the `__n` that is passed in, it saves off `size() + 
__n`.

http://reviews.llvm.org/D8109

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to