joern icon indicating copy to clipboard operation
joern copied to clipboard

[Bug][C][C23] Empty methods with `_Noreturn` attribute

Open mal-tee opened this issue 6 months ago • 1 comments

Describe the bug Methods with _Noreturn have an empty method body

To Reproduce

#include <stdio.h>
#include <stdlib.h>

static void _Noreturn execute(char **argv) {
    printf("Execute");
    exit(0);
}

int main(int argc, char **argv) {
    execute(argv);
}

// in joern, after importCode():
cpg.method("execute").code.l // empty

Expected behavior The method should not be empty.

Desktop (please complete the following information): Latest joern via docker/nightly (4.0.388)

mal-tee avatar Jul 11 '25 08:07 mal-tee

Not 100% sure but I guess CDT is not able to parse methods with _Noreturn. You could try to run c2cpg with the --with-include-auto-discovery flag in case _Noreturn is defined in one of the included system headers.

max-leuthaeuser avatar Jul 11 '25 08:07 max-leuthaeuser