https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113895
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Richard Biener <rgue...@gcc.gnu.org>: https://gcc.gnu.org/g:94225dfb5623725fa519eac69338f7a632a509ae commit r14-8956-g94225dfb5623725fa519eac69338f7a632a509ae Author: Richard Biener <rguent...@suse.de> Date: Tue Feb 13 11:10:57 2024 +0100 tree-optimization/113895 - copy_reference_ops_from_ref vs. bitfields The recent enhancement to discover constant array indices by range info used by get_ref_base_and_extent doesn't work when the outermost component reference is to a bitfield because we track the running offset in the reference ops as bytes. The following does as ao_ref_init_from_vn_reference and recovers that manually, tracking the offset for the purpose of discovering the constant array index in bits instead. PR tree-optimization/113895 * tree-ssa-sccvn.cc (copy_reference_ops_from_ref): Track offset to discover constant array indices in bits, handle COMPONENT_REF to bitfields. * gcc.dg/torture/pr113895-1.c: New testcase.