https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62029
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Status|UNCONFIRMED |NEW Last reconfirmed| |2017-07-22 CC| |msebor at gcc dot gnu.org See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=80711 Ever confirmed|0 |1 --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- Confirmed. This enhancement would be especially useful in C++. See also pr80711 for a related request. It would make sense to consider both of these together. In C, one caveat/question specific to this request (pointers) is what to do about C functions like strchr: void f (char *p) { char *q = strchr (p, '\0'); *q = 'x'; } or strtol: void g (char *p) { char *q; strtol (p, &q, 0); *q = '\0'; } To avoid false positives on this code the warning would have to handle these cases specially. That's not difficult to do for functions like strchr that GCC has intrinsic knowledge of but not for others (like strtol).