Tested with pahole v1.24. The following code, when compiled with either GCC 14 or Clang 16 or several other versions, and post processed with pahole -J, results in the private definition of foo in bar being exposed as part of the type of baz in BTF - which is definitely wrong. struct foo; int bar() { struct foo { int x; }; struct foo j = { 0 }; struct foo k = j; return j.x == k.x; } int baz(struct foo* j) { return j != 0; } Note that we had exactly the same bug in STG and I resolved it by pushing an anonymous scope before processing the function child DIEs (we deal with C++ scopes). You could perhaps push / pop a flag which inhibits type definition processing. It's not possible to just ignore type DIEs inside functions because (at least) Clang sometimes emits references outside the function to such DIEs. Regards, Giuliano.