https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87532
--- Comment #11 from Bill Schmidt <wschmidt at gcc dot gnu.org> --- Let me take back what I said earlier. We've had full support for vec_extract with a variable second argument for quite a long time. So let me try again responding to comment #4. We have special-case code for ALTIVEC_BUILTIN_VEC_EXTRACT in rs6000-c.c when handling overloaded built-ins. There is short-circuit code there for cases where the second argument is a constant and in-range, as well for cases where the second argument is variable and we have a direct-move instruction available. In all other cases, we are supposed to expand this code into address arithmetic: /* Build *(((arg1_inner_type*)&(vector type){arg1})+arg2). */ But the fact that you are seeing the error message about the selector being out of range indicates that we are expanding the vector built-in via rs6000.c: altivec_expand_builtin, which in turn means that rs6000_overloaded_builtin_p failed to expand the call. We need to understand why the code in altivec_resolve_overloaded_builtin is not being expanded as expected. So please set a breakpoint there and look at the fndecl to see what's going on.