https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99317
Bug ID: 99317 Summary: Missed warning Product: gcc Version: 10.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: pj at hugeone dot co.uk Target Milestone: --- The code: int *foo(void *v, void *w, int x) { float * f = v; int * i = w; return (x ? f : i); } int *foo1(void *v, void *w, int x) { float * f = v; int * i = w; return (1 ? f : (void *)i); } int *bar(void *v, void *w, int x) { float * f = v; int * i = w; return (x ? f : (void *)i); } Function foo correctly emits the warning: source>: In function 'foo': <source>:7:19: warning: pointer type mismatch in conditional expression 7 | return (x ? f : i); | ^ Casting removes that warming even in the trivial foo1 example. https://godbolt.org/z/ozsPPY