https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87084
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |accepts-invalid Status|UNCONFIRMED |NEW Last reconfirmed| |2018-08-24 Component|other |c Version|unknown |8.2.1 Ever confirmed|0 |1 --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- It's because of rtx expand_builtin (tree exp, rtx target, rtx subtarget, machine_mode mode, int ignore) { ... case BUILT_IN_VA_ARG_PACK: /* All valid uses of __builtin_va_arg_pack () are removed during inlining. */ error ("%Kinvalid use of %<__builtin_va_arg_pack ()%>", exp); return const0_rtx; case BUILT_IN_VA_ARG_PACK_LEN: /* All valid uses of __builtin_va_arg_pack_len () are removed during inlining. */ error ("%Kinvalid use of %<__builtin_va_arg_pack_len ()%>", exp); return const0_rtx; and diagnostics of valid/invalid uses of these builtins should really happen in the FE (they may be only used in variadic functions and those functions need to be marked always-inline either by the user or the frontend). So - marking as C-family FE bug. We should reject this testcase and the above code should be changed to ICE.