https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96527
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |jakub at gcc dot gnu.org Resolution|--- |INVALID --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The error is correct. __builtin_va_arg_pack_len or __builtin_va_arg_pack can't work in functions that are not inlined. And the documentation you refer to is clear about it for both: "It can be used only in inline functions that are always inlined, never compiled as a separate function, such as those using __attribute__ ((__always_inline__)) or __attribute__ ((__gnu_inline__)) extern inline functions." So, either you need to compile with -fgnu-inline, or have the gnu_inline attribute on it if it is extern inline, or it must be only inline and not extern inline for the standard C. extern inline __attribute__ ((__gnu_inline__)) is the mode it was designed for, if it can be inline, you use something that accesses the ... arguments, otherwise either you have a guarantee it will never be called out of line, or there is some external definition which will not use these builtins and will handle ... normally through va_{list,start,arg,end}.