https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67629
Bug ID: 67629
Summary: bogus -Wreturn-type in a function with tautological
if-else
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gcc dot gnu.org
Target Milestone: ---
While testing Marek's patch for PR 64249 I noticed that both gcc and g++
incorrectly issue a -Wreturn-type warning for the following snippet:
$ cat u.c && xgcc -Wreturn-type -c u.c
int foo (_Bool a) {
if (a) return 0;
else if (!a) return 1;
}
u.c: In function ‘foo’:
u.c:4:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^