The following code is perfectly fine, but currently generates a bogus warning:
int f(unsigned);
int test(int i) {
if (i < 0)
return 0;
return f(i);
}
<source>:7:14: warning: implicit conversion changes signedness: 'int' to 'unsigned int' [-Wsign-conversion]
7 | return f(i);
| ~ ^
https://godbolt.org/z/6KzM1K36f
i can never be negative at that point (and I'm pretty sure other warnings know that), so there shouldn't be a warning when it gets converted to unsigned.
I have also filed a matching bug with gcc: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123127