https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104690
--- Comment #3 from Vincent Lefèvre <vincent-gcc at vinc17 dot net> --- Well, I can understand that this may be difficult in some cases. For instance: static int f (void) { if (complex_condition_1) return 1; } and used with if (complex_condition_2) printf ("%d\n", f ()); else f (); This means that the compiler would need to insert code to track non-specified return values. That said, I suspect that in most practical cases (with a static function), for instance as in PR116690, the compiler will be able to know whether a non-specified return value is used at some point.