https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78917
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> --- Another test case: $ cat f.c && gcc -O2 -S -Wall -Wextra f.c int f (int i) { const char * p = __builtin_strchr (i ? "123" : "456", '2'); return __builtin_strlen (p); } The strlen argument is a phi with a null operand so that should make it easy to detect: # prephitmp_11 = PHI <_10(3), 0B(2)> _1 = __builtin_strlen (prephitmp_11);