1 // PR tree-optimization/83239 - False positive from -Wstringop-overflow
2 // on simple std::vector code
4 // { dg-options "-O3 -finline-limit=500 -Wall -fdump-tree-optimized" }
5 // { dg-skip-if "requires hosted libstdc++ for vector" { ! hostedlib } }
9 // Verify no warnings are issued.
20 const typename std::vector<T>::size_type sz = a.size ();
31 // Verify no warnings are issued here either.
34 void test_if (std::vector<T> &a, int num)
38 const typename std::vector<T>::size_type sz = a.size ();
47 // Instantiate each function on a different type to force both
48 // to be fully inlined. Instantiating both on the same type
49 // causes the inlining heuristics to outline _M_default_append
50 // which, in turn, masks the warning.
51 template void test_loop<int>();
52 template void test_if<long>(std::vector<long>&, int);
54 // Verify that std::vector<T>::_M_default_append() has been inlined
55 // (the absence of warnings depends on it).
56 // { dg-final { scan-tree-dump-not "_ZNSt6vectorIiSaIiEE17_M_default_appendEm" optimized } }
57 // { dg-final { scan-tree-dump-not "_ZNSt6vectorIPvSaIS0_EE17_M_default_appendEm" optimized } }