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

            Bug ID: 118308
           Summary: compiling code that should return without a return
                    statement
           Product: gcc
           Version: 14.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: raffaellobertini at gmail dot com
  Target Milestone: ---

This following code is compiling:

file test.c
```
#include <stdbool.h>
#include <stdio.h>

bool f()
{
    printf("f");
}

int main(int argc, char* argv[])
{
    f();
    return 0;
}
```

but what f() returns? I experienced a similar code that in win-mingw returning
true and in linux returning false.

compiling just with defaults gives no error: `gcc test.c`

In my perspective should not compile at all as it does not return a value
explicitly.

To have that kind of error it must be compiled with '-Werror-return-type'

Would it be possible to enable by default the -Wreturn-type at least?
and if someone doesn't want it will compile with 'Wno-return-type' ?

Reply via email to