[Bug tree-optimization/93266] strlen pass could optimize strncpy with known strlen (src) == 0 into memset

2020-01-14 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93266 Martin Sebor changed: What|Removed |Added Status|UNCONFIRMED |NEW Keywords|

[Bug tree-optimization/93266] strlen pass could optimize strncpy with known strlen (src) == 0 into memset

2020-01-14 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93266 --- Comment #2 from Jakub Jelinek --- If the strlen pass would handle if (__builtin_strlen (a)) return; if we disabled the early folding, then it should be taught to handle whatever it is folded to. Though, I'm not sure it can, there is no code t

[Bug tree-optimization/93266] strlen pass could optimize strncpy with known strlen (src) == 0 into memset

2020-01-14 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93266 --- Comment #3 from Martin Sebor --- The strlen pass sets the range for non-constant strlen results so it can handle (and make use of) this sort of thing by querying the range of the strlen lhs. For example, it detects the buffer overflow in the