https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116034
--- Comment #14 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-13 branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:aaa82d63fed5978a0bc7136a3922d280576ce257 commit r13-9020-gaaa82d63fed5978a0bc7136a3922d280576ce257 Author: Jakub Jelinek <ja...@redhat.com> Date: Tue Jul 23 10:50:29 2024 +0200 ssa: Fix up maybe_rewrite_mem_ref_base complex type handling [PR116034] The folding into REALPART_EXPR is correct, used only when the mem_offset is zero, but for IMAGPART_EXPR it didn't check the exact offset value (just that it is not 0). The following patch fixes that by using IMAGPART_EXPR only if the offset is right and using BITFIELD_REF or whatever else otherwise. 2024-07-23 Jakub Jelinek <ja...@redhat.com> Andrew Pinski <quic_apin...@quicinc.com> PR tree-optimization/116034 * tree-ssa.cc (maybe_rewrite_mem_ref_base): Only use IMAGPART_EXPR if MEM_REF offset is equal to element type size. * gcc.dg/pr116034.c: New test. (cherry picked from commit b9cefd67a2a464a3c9413e6b3f28e7dc7a9ef162)