libstdc++: Add testcase for bogus -Wstringop-overflow in std::vector [PR117983]
This was fixed on trunk by r15-4473-g3abe751ea86e34, just add the testcase. libstdc++-v3/ChangeLog: PR libstdc++/117983 * testsuite/23_containers/vector/modifiers/insert/117983.cc: New test.
This commit is contained in:
parent
fb132276d1
commit
878812b6f6
1 changed files with 17 additions and 0 deletions
|
@ -0,0 +1,17 @@
|
|||
// { dg-options "-O3 -Werror=stringop-overflow" }
|
||||
// { dg-do compile }
|
||||
|
||||
// PR libstdc++/117983
|
||||
// -Wstringop-overflow false positive for __builtin_memmove from vector::insert
|
||||
|
||||
#include <vector>
|
||||
|
||||
typedef std::vector<unsigned char> bytes;
|
||||
|
||||
void push(bytes chunk, bytes& data) {
|
||||
if (data.empty()) {
|
||||
data.swap(chunk);
|
||||
} else {
|
||||
data.insert(data.end(), chunk.begin(), chunk.end());
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue