https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83303
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2017-12-06 CC| |msebor at gcc dot gnu.org Component|middle-end |testsuite Ever confirmed|0 |1 --- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> --- I can reproduce the warning with an arm-non-eabi cross-compiler. Based on the source code copied below the warning seems justified: template <typename T> void QScript::Buffer<T>::resize(int s) { if (m_capacity < s) // s == 0 so m_capacity is negative reserve (s << 1); } template <typename T> void QScript::Buffer<T>::reserve(int x) { T *new_data = new T[m_capacity]; // m_capacity is negative ... } inline void QScriptObject::reset() { m_values.resize(0); } Other compilers, and with -O2 also the arm-non-eabi cross-compiler, optimize the test to a trap, further validating that a warning is justified (in fact, I'd say not issuing one is suboptimal given that the emitted code will unavoidably abort at runtime). QScript::Ecma::Boolean::newBoolean (struct Boolean * const this, struct QScriptValueImpl * result, bool value) { int _4; <bb 2> [local count: 1073741825]: _4 ={v} MEM[(int *)0B + 4B]; __builtin_trap (); } Since the purpose of the test is to verify the absence of an ICE (pr39367), whether or not it triggers any warnings doesn't seem important and pruning them from its output should be appropriate.