[Bug c/118308] compiling code that should return without a return statement

2025-01-05 Thread raffaellobertini at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118308 --- Comment #3 from Raffaello Bertini --- ok thanks for the reply. btw it is enough to enable the warnigs. ``` bool f() { printf("f"); } int main(int argc, char* argv[]) { if (f()) printf("y"); else printf("n");

[Bug c/118308] compiling code that should return without a return statement

2025-01-05 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118308 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---

[Bug c/118308] compiling code that should return without a return statement

2025-01-05 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118308 --- Comment #1 from Andrew Pinski --- It is only undefined behavior if you use the value from a function which has a return type but does not return a value. The example you have in comment #0 is 100% well defined C code. Note C++ is different