https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80265
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Perhaps we then need some helper function partly similar to cxx_eval_array_ref, that would for an object (or address of it?) and some uhwi index attempt to return some byte from the object, and then if the middle-end folding doesn't yield anything, handle these builtins by using that helper in a loop to grab bytes from one or two input strings, then perform the needed action on them as if we have open-coded those routines in trivial C loops. As even constexpr char foo (int x) { char a[] = { 'a', 'b', 'c', 'd', '\0' }; char *b = &a[0]; return ((unsigned char *)b)[x]; } constexpr char a = foo (0); is rejected, I think we can't use the existing routines here though, we want to be able to access bytes of anything initialized.