[LLVMdev] Bug in MapVector::erase ?

Oliver Stannard oliver.stannard at arm.com
Tue Jul 15 07:35:24 PDT 2014


Do you have a reproducer for this problem? MapVector::erase removes the
value from both the Vector and the Map, so it should not suffer from this
problem. 

 

Oliver

 

From: Yaron Keren [mailto:yaron.keren at gmail.com] 
Sent: 15 July 2014 15:18
To: cfe-dev at cs.uiuc.edu Developers; llvmdev at cs.uiuc.edu; Oliver Stannard
Subject: Re: Bug in MapVector::erase ?

 

+llvmdev +Oliver. MapVector::erase was added in r211273.

 

To avoid duplications, MapVector stores Values inside the vector only, while
the map caches key->indices to the vector.


When a value is erased from the MapVector, it is removed from the vector,
invalidating the cached vector indices stored in the map, so the map points
to wrong locations and the MapVector is corrupted.
--
Yaron

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140715/736be057/attachment.html>


More information about the llvm-dev mailing list