Fix all tests that fail with -sanitize=return.
[official-gcc.git] / gcc / testsuite / g++.dg / tree-ssa / pr46228.C
blob1178eb7038e704d6f3655acbe6c9ab775c4af5ee
1 // { dg-options "-fdump-tree-optimized -Os" }
2 #include <set>
3 #include <stdio.h>
5 int main()
7   static const int array[] = { 1,2,3,4,5,6,7,8,9,10,6 };
8   std::set<int> the_set;
9   int count = 0;
10   for (unsigned i = 0; i < sizeof(array)/sizeof(*array); i++)
11   {
12     std::pair<std::set<int>::iterator, bool> result =
13       the_set.insert(array[i]);
14     if (result.second)
15       count++;
16   }
17   printf("%d unique items in array.\n", count);
18   return 0;
21 // This function is small enough to be inlined even at -Os.
22 // { dg-final { scan-tree-dump-not "_ZNSt8_Rb_treeIiiSt9_IdentityIiESt4lessIiESaIiEED2Ev" "optimized" } }