https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107730

            Bug ID: 107730
           Summary: Trivial -Wreturn-type false positive when function
                    marked static
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sam at gentoo dot org
  Target Milestone: ---

Created attachment 53915
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53915&action=edit
foo.i

```
#include <unistd.h>

static void *poll_logfiles(int n) {
        for (;;) {
                sleep(1);
        }
}

int main() {
        poll_logfiles(0);
}
```

```
$ gcc-9.5.0 /tmp/foo.c -Wreturn-type
/tmp/foo.c: In function 'poll_logfiles':
/tmp/foo.c:7:1: warning: no return statement in function returning non-void
[-Wreturn-type]
    7 | }
      | ^

# 10.4.1_p20221110
$ gcc-10 /tmp/foo.c -Wreturn-type
/tmp/foo.c: In function 'poll_logfiles':
/tmp/foo.c:7:1: warning: no return statement in function returning non-void
[-Wreturn-type]
    7 | }
      | ^

# 11.3.1_p20221111
$ gcc-11 /tmp/foo.c -Wreturn-type
/tmp/foo.c: In function 'poll_logfiles':
/tmp/foo.c:7:1: warning: no return statement in function returning non-void
[-Wreturn-type]
    7 | }
      | ^

# 12.2.1_p20221112
$ gcc-12 /tmp/foo.c -Wreturn-type
/tmp/foo.c: In function ‘poll_logfiles’:
/tmp/foo.c:7:1: warning: no return statement in function returning non-void
[-Wreturn-type]
    7 | }
      | ^

# 13.0.0_pre20221113
$ gcc-13 /tmp/foo.c -Wreturn-type
/tmp/foo.c: In function 'poll_logfiles':
/tmp/foo.c:7:1: warning: no return statement in function returning non-void
[-Wreturn-type]
    7 | }
      | ^
```

Reply via email to