Hi, there is a thinko in the recent improvement by Jan: 2020-11-19 Jan Hubicka * fold-const.c (operand_compare::operand_equal_p): Fix thinko in COMPONENT_REF handling and guard types_same_for_odr by virtual_method_call_p. (operand_compare::hash_operand): Likewise. where the code just looks at operand 2 of COMPONENT_REF, if it is present, to compare addresses. That's wrong because operand 2 contains the number of DECL_OFFSET_ALIGN-bit-sized words so, when DECL_OFFSET_ALIGN > 8, not all the bytes are included and some of them are in DECL_FIELD_BIT_OFFSET instead, see get_inner_reference for the model computation. In other words, you would need to compare operand 2 and DECL_OFFSET_ALIGN and DECL_FIELD_BIT_OFFSET in this situation, but I'm not sure this is worth the hassle in practice so the attached fix just removes this alternate handling. Tested on x86-64/Linux, OK for mainline, 12 and 11 branches? 2022-11-04 Eric Botcazou * fold-const.cc (operand_compare::operand_equal_p) : Do not take into account operand 2. (operand_compare::hash_operand) : Likewise. 2022-11-04 Eric Botcazou * gnat.dg/opt99.adb: New test. * gnat.dg/opt99_pkg1.ads, gnat.dg/opt99_pkg1.adb: New helper. * gnat.dg/opt99_pkg2.ads: Likewise. -- Eric Botcazou