For reference, I committed r255450 to avoid the test failure reported on the arm-none-eabi target. The warning is valid but unrelated to the purpose of the test so I pruned it from its output.
Martin Index: gcc/testsuite/ChangeLog =================================================================== --- gcc/testsuite/ChangeLog (revision 255449) +++ gcc/testsuite/ChangeLog (working copy) @@ -9,6 +9,9 @@ 2017-12-06 Martin Sebor <mse...@redhat.com> + PR testsuite/83303 + * g++.dg/opt/new1.C: Prune warning from test output. + PR tree-optimization/82646 * gcc.dg/builtin-stringop-chk-1.c: Adjust. * gcc.dg/builtin-stringop-chk-9.c: New test. Index: gcc/testsuite/g++.dg/opt/new1.C =================================================================== --- gcc/testsuite/g++.dg/opt/new1.C (revision 255449) +++ gcc/testsuite/g++.dg/opt/new1.C (working copy) @@ -1,4 +1,4 @@ -// PR c++/39367 +// PR c++/39367 - ICE at tree-inline.c:1042 with -O // { dg-options "-O" } class QScriptEnginePrivate; @@ -37,6 +37,11 @@ template <typename T> void QScript::Buffer<T>::res reserve (s << 1); } template <typename T> void QScript::Buffer<T>::reserve(int x) { + /* The following may be optimized into a trap because the function + is called from resize(0) and so with m_capacity < 0. When not + optimized it may trigger -Walloc-size-larger-than= since + operator new() is called with an excessively large value. + The warning is pruned from the test output below. */ T *new_data = new T[m_capacity]; for (int i=0; i<m_size; ++i) new_data[i] = m_data[i]; @@ -69,3 +74,5 @@ namespace QScript { } } } + +// { dg-prune-output "\\\[-Walloc-size-larger-than=]" }