I would like the following snippet to crash due to bounds checking. Instead, it
prints a garbage value.

----

#include <stdio.h>
#include <vector>

using std::vector;

main ()
{
  vector<int> x;
  x.push_back(5);
  x.pop_back();


  printf ("%d\n", x.back ());
}


-- 
           Summary: std::vector::back() does no boundscheck
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hanwen at xs4all dot nl


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29081

Reply via email to