https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90404
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |11.0 Component|c |middle-end --- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> --- No progress for GCC 10. I plan to work on it for GCC 11. Here's a test case where the fact that the modification is invalid is less obvious and doesn't trigger a warning. The dump shows how the code emitted by GCC makes assumptions that make the undefined behavior manifest without ever causing the program to crash at runtime. $ cat x.C && gcc -O2 -S -Wall -Wextra -Wcast-qual -Wpedantic -fdump-tree-optimized=/dev/stdout x.C const char a[] = "012.45"; int f (void) { char *p = __builtin_strchr (a, '.'); *p = 0; if (__builtin_strlen (p) != 3) // folded to false __builtin_abort (); return a[3] == 0; // also folded to false } ;; Function f (_Z1fv, funcdef_no=0, decl_uid=2328, cgraph_uid=1, symbol_order=1) f () { <bb 2> [local count: 1073741824]: return 0; }