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

--- Comment #3 from Marc Glisse <glisse at gcc dot gnu.org> ---
We already have infer_nonnull_range_by_attribute ("Return true if OP can be
inferred to be a non-NULL after STMT executes by using attributes") and I
assume that strstr has the nonnull attribute in this example, so the match.pd
transform would be redundant (not that that's always bad). And it wouldn't help
anyway since strstr(s,"") gets replaced with "s" before we see the NE_EXPR.

There are many cases where a simplification loses range information. If I
simplify i-1+1 to just i, I lose the information that i cannot be INT_MIN,
which could be relevant to some other simplification later. I don't believe
there is an easy fix for that.

Reply via email to