title: assuming signed overflow does not occur in if statement
body: <p>Why is this warning appearing? It's not really an assumption if I check the bounds. And how to fix?</p>
  
  <p>If <code>num_actions_to_skip</code> is set to 1, instead of 2, the error goes away.</p>
  
  <p>Thanks</p>
  
  <pre><code>error: assuming signed overflow does not occur when assuming that (X - c) &lt;= X is always true [-Werror=strict-overflow]
  cc1plus: all warnings being treated as errors
  </code></pre>
  
  <p>On <code>if (loc &gt;= 0 &amp;&amp; loc &lt; action_list.count()) {</code></p>
  
  <pre><code>const QList&lt;QAction *&gt; &amp;action_list = tool_menu-&gt;actions();
  static const int num_actions_to_skip = 2;
  const int loc = action_list.count() - num_actions_to_skip;
  if (loc &gt;= 0 &amp;&amp; loc &lt; action_list.count()) {
      tool_menu-&gt;insertAction(action_list.at(loc),
                              action);
  }
  </code></pre>
  
  <p>It started with</p>
  
  <pre><code>Q_ASSERT_X(i &gt;= 0 &amp;&amp; i &lt; p.size()
  </code></pre>
  
  <p>at qlist.h:454, which performs the same check, and throws this error as well, with just</p>
  
  <pre><code>tool_menu-&gt;insertAction(action_list.at(action_list.count() - 2),
                                  action);
  </code></pre>