https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79310
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- A similar case and optimization opportunity (and also a possible source of false positives) exists with strchr. $ cat t.c && gcc -O2 -S -Wall -fdump-tree-optimized=/dev/stdout t.c void foo (const char *s, int x) { if (!__builtin_strchr (s, '\0')) __builtin_abort (); } ;; Function foo (foo, funcdef_no=0, decl_uid=1796, cgraph_uid=0, symbol_order=0) foo (const char * s, int x) { char * _1; long unsigned int _4; <bb 2> [100.00%]: _4 = __builtin_strlen (s_3(D)); _1 = s_3(D) + _4; if (_1 == 0B) goto <bb 3>; [0.04%] else goto <bb 4>; [99.96%] <bb 3> [0.04%]: __builtin_abort (); <bb 4> [99.96%]: return; }