https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96133
--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:8614106f121db118f9db260b9949883485d0bbf6 commit r10-8455-g8614106f121db118f9db260b9949883485d0bbf6 Author: Richard Biener <rguent...@suse.de> Date: Thu Jul 9 16:03:45 2020 +0200 fix constant folding from array CTORs This fixes the case where we try to fold a read from an array initalizer and happen to cross the boundary of multiple CTORs which isn't really supported. For the interesting cases like the testcase we actually handle the folding by encoding the whole initializer. 2020-07-10 Richard Biener <rguent...@suse.de> PR tree-optimization/96133 * gimple-fold.c (fold_array_ctor_reference): Do not recurse to folding a CTOR that does not fully cover the asked for object. * gcc.dg/torture/pr96133.c: New testcase. (cherry picked from commit 6e41c27bf549d957eb399d39d7d0c213f8733351)