https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91326

Martin Sebor <msebor at gcc dot gnu.org> changed:

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

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
Associating the minimum and maximum with the declaration of each constant array
object would be a simple way of doing it but I'm not sure how much it would
gain.  Doing better would mean a linear traversal of the array.  That seems to
be what Clang does -- it folds even equalities with values in the range [MIN,
MAX] that aren't in the array.  An only slightly less costly approach would be
to only search the elements between the lower and upper bounds of the index.

I pondered doing this for strcmp and strlen but the linear search felt too
expensive (Clang doesn't do it).  It might be worth getting some data on how
often it would trigger and what it would cost.

Reply via email to