Page 1 of 1

No warnings about functions with missing return directives

Posted: Fri Aug 15, 2025 4:21 pm
by squire
All the other build systems I've used will fail to compile if a function has a return type but not all code paths lead to a return statement, except for IDF. In IDF, functions build just fine and usually I find the bug in the form of a stack corruption; though in the following case, omitting the return statement causes the loop to run infinitely.

Code: Select all

    int example()
    {
        for (int i = 0; i < 32; i++)
        {
            printf("i = %i\n", i);
        }
    }
Is this expected behaviour? I feel like this is an issue with the build system or compiler. This only happens when building C++ files. If I try the same thing in a C file, the compiler throws the following error:
error: control reaches end of non-void function [-Werror=return-type]
Assuming this is a bug, where should I make the report?

Re: No warnings about functions with missing return directives

Posted: Mon Aug 25, 2025 11:58 am
by adokitkat
Hello. Could you please report it here? https://github.com/espressif/esp-idf/issues

Very much appreciated, thank you.