http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57199

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I don't think the warning is bogus.
At phiprop we have:
  long unsigned int _3;
  size_t _6;
  size_t _7;
  long unsigned int _8;

  <bb 2>:
  _6 = MEM[(const struct InlinedVector *)this_1(D)].size_;
  _3 = _6 + 1;
...
  _7 = MEM[(const struct InlinedVector *)this_1(D)].size_;
  if (_3 < _7)
    goto <bb 3>;
  else
    goto <bb 6>;

  <bb 3>:
  _8 = _7 - _3;

and fre2 turns this into:

  _6 = MEM[(const struct InlinedVector *)this_1(D)].size_;
  _3 = _6 + 1;
...
  _7 = _6;
  if (_3 < _7)
    goto <bb 3>;
  else
    goto <bb 6>;

  <bb 3>:
  _8 = 18446744073709551615;

i.e. it can't prove the following loop that uses _8 as upper bound is dead, but
the loop has at that point constant bounds and triggers undefined behavior in
it if executed.  The loop can be only executed if foo_.size() is (size_t) -1,
but if you call it with this value, you'll surely hit the undefined behavior
the warning is complaining about.

Reply via email to