1 // PR tree-optimization/83239 - False positive from -Wstringop-overflow
2 // on simple std::vector code
4 // { dg-options "-O3 -Wall -fdump-tree-optimized" }
8 // Verify no warnings are issued.
19 const typename std::vector<T>::size_type sz = a.size ();
30 // Verify no warnings are issued here either.
33 void test_if (std::vector<T> &a, int num)
37 const typename std::vector<T>::size_type sz = a.size ();
46 // Instantiate each function on a different type to force both
47 // to be fully inlined. Instantiating both on the same type
48 // causes the inlining heuristics to outline _M_default_append
49 // which, in turn, masks the warning.
50 template void test_loop<int>();
51 template void test_if<long>(std::vector<long>&, int);
53 // Verify that std::vector<T>::_M_default_append() has been inlined
54 // (the absence of warnings depends on it).
55 // { dg-final { scan-tree-dump-not "_ZNSt6vectorIiSaIiEE17_M_default_appendEm" optimized } }
56 // { dg-final { scan-tree-dump-not "_ZNSt6vectorIPvSaIS0_EE17_M_default_appendEm" optimized } }