https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114682
--- Comment #6 from Drea Pinski <pinskia at gcc dot gnu.org> ---
So it looks like fold_const_aggregate_ref_1 does not handle this case.
As mention in it as a fixme:
/* Constant indexes are handled well by get_base_constructor.
Only special case variable offsets.
FIXME: This code can't handle nested references with variable indexes
(they will be handled only by iteration of ccp). Perhaps we can bring
get_ref_base_and_extent here and make it use a valueize callback. */