bounds checking in STL containers

Florian Weimer fweimer@redhat.com
Tue Oct 16 08:41:00 GMT 2012


On 10/15/2012 07:14 PM, АÑ
риев Альберт wrote:

> Two-three generations ago g++ was very cautious about consistency checking but not now.

Not sure if this is true.  The at() member function performs such 
checking, but not operator[].

We looked at bounds checking for operator[] under -D_FORTIFY_SOURCE, but 
GCC isn't able to hoist the bounds check out of inner loops, so the 
impact is pretty significant:

<http://gcc.gnu.org/ml/libstdc++/2012-06/msg00002.html>

-- 
Florian Weimer / Red Hat Product Security Team



More information about the Gcc mailing list