https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107843
--- Comment #1 from David Faust <david.faust at oracle dot com> --- Looks like this is an issue with passing void* where an enum type is expected in a function call. This is not specific to the BPF backend. Not entirely clear to me whether this is expected or a bug, but it does differ from llvm behavior. Reproducer below, tried with a few gccs, same behavior: today (6 Dec 2022)'s master 81476bc4f4a20bcf3af7ac2548c2322d48499402 gcc-12 (Debian 12.2.0-9) 12.2.0 gcc-10 (Debian 10.4.0-5) 10.4.0 gcc-8 (Debian 8.4.0-7) 8.4.0 $ cat enumcast.c enum E { E_FOO = 0, E_BAR = 1, }; int foo_enum (enum E e); int bar_enum (enum E e) { return foo_enum ((void *) e); } int foo_int (int x); int bar_int (int x) { return foo_int ((void *) x); } $ gcc -c enumcast.c -o enumcast.o enumcast.c: In function ‘bar_enum’: enumcast.c:10:20: error: incompatible type for argument 1 of ‘foo_enum’ 10 | return foo_enum ((void *) e); | ^~~~~~~~~~ | | | void * enumcast.c:7:22: note: expected ‘enum E’ but argument is of type ‘void *’ 7 | int foo_enum (enum E e); | ~~~~~~~^ enumcast.c: In function ‘bar_int’: enumcast.c:16:19: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 16 | return foo_int ((void *) x); | ^ enumcast.c:16:19: warning: passing argument 1 of ‘foo_int’ makes integer from pointer without a cast [-Wint-conversion] 16 | return foo_int ((void *) x); | ^~~~~~~~~~ | | | void * enumcast.c:13:18: note: expected ‘int’ but argument is of type ‘void *’ 13 | int foo_int (int x); | ~~~~^ $ clang -c enumcast.c -o enumcast.o enumcast.c:10:20: warning: incompatible pointer to integer conversion passing 'void *' to parameter of type 'enum E' [-Wint-conversion] return foo_enum ((void *) e); ^~~~~~~~~~ enumcast.c:7:22: note: passing argument to parameter 'e' here int foo_enum (enum E e); ^ enumcast.c:16:19: warning: cast to 'void *' from smaller integer type 'int' [-Wint-to-void-pointer-cast] return foo_int ((void *) x); ^~~~~~~~~~ enumcast.c:16:19: warning: incompatible pointer to integer conversion passing 'void *' to parameter of type 'int' [-Wint-conversion] return foo_int ((void *) x); ^~~~~~~~~~ enumcast.c:13:18: note: passing argument to parameter 'x' here int foo_int (int x); ^ 3 warnings generated.