[Bug tree-optimization/85929] _GLIBCXX_ASSERTIONS, subscript type mismatch, and std::vector bounds check elimination

2018-05-28 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85929

--- Comment #4 from Marc Glisse  ---
(In reply to Richard Biener from comment #2)
> So somehow we need to enhance the code in VRP that registers additional
> asserts to also handle symbolic ranges and thus register not only
> i_4 < count_8 but also (long int) i_4 < _16 in a usable form.

(long int) i_4 < _16 may not hold, _16 could easily be negative.

[Bug tree-optimization/85929] _GLIBCXX_ASSERTIONS, subscript type mismatch, and std::vector bounds check elimination

2018-05-28 Thread fw at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85929

--- Comment #3 from Florian Weimer  ---
(In reply to Richard Biener from comment #2)
> That is,
> for > UINT_MAX # of elements the code will infintely loop AFAICS (but it will
> not access elements out of bounds).

The way I read the original source code, the code will simply not touch all the
vector elements in that case (but there is still no out-of-bounds access).