https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128591
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic, false-negative
Status|UNCONFIRMED |NEW
Last reconfirmed| |2026-11-10
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed. But the issue is really that late diagnostics are fragile - GCC is
an optimizing compiler first and foremost, not a static analysis engine.
It sounds like we might want a -fdefer-optimizations-inhibiting-diagnostics
given that adding -W flags may not affect code generation.
Another option is to keep the original as
# DEBUG D.124 = __builtin_strstr (a, "");
or so and diagnose those.
Consider
const char *probe_empty_needle (const char *a)
{
return __builtin_strstr(a, "");
}
where the exact 'a' might never be exposed or only exposed with LTO after
inlining.