https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92262
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Actually, to be precise, get_computation_at does unshare expressions, that is done in unshare_aff_combination. The problem is that afterwards aff_combination_to_tree calls fold_build* and those invoke the various GENERIC folders and those do not generally guarantee unsharing. In particular, fold_binary_op_with_conditional_arg is eventually called, with (sizetype) _5 + 18446744073709551609 <= (sizetype) _29 ? ((((unsigned long) _29 - (unsigned long) _5) + 7) / 8 + 1) * 4 : 4 as op0 and (unsigned long) &a8 as op1 and it adds the (unsigned long) &a8 operand to both the ... * 4 and 4 expressions and so appears twice. Now, I'm not sure what the right fix is, because in theory this can happen in lots of places. Either fold-const.c could unshare_expr if it uses an operand multiple times and it is during or after gimplification, or just various places in GIMPLE which fold trees and then try to gimplify them need to unshare just in case (especially because the gimplifier is destructive and when gimplifying one copy it might clobber the other one), something else?