Consider a function foo() that might never exit:
int foo(int n) {
if(n != 0) return n;
else for(;;); /* intentional infinite loop */
return 0; /* (*) */
}
Is it valid C to omit the final return-statement? Will it evoke undefined behavior if I leave out that final statement?
Even if it does return without a return statement there is no UB unless you use the return value.