https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80974
--- Comment #6 from Marc Glisse <glisse at gcc dot gnu.org> --- The conditions and location are probably not right, but at least the testcase passes, so this gives an idea of where the problem is. --- tree-ssa-sccvn.c (revision 248859) +++ tree-ssa-sccvn.c (working copy) @@ -3364,20 +3364,32 @@ set_ssa_val_to (tree from, tree to) if (! VN_INFO (to)->info.range_info) { VN_INFO (to)->info.range_info = SSA_NAME_RANGE_INFO (to); VN_INFO (to)->range_info_anti_range_p = SSA_NAME_ANTI_RANGE_P (to); } /* Rather than allocating memory and unioning the info just clear it. */ SSA_NAME_RANGE_INFO (to) = NULL; } + + /* Restore old info. */ + if (TREE_CODE (currval) == SSA_NAME + && INTEGRAL_TYPE_P (TREE_TYPE (currval)) + && VN_INFO (currval)->info.range_info) + { + SSA_NAME_RANGE_INFO (currval) + = VN_INFO (currval)->info.range_info; + SSA_NAME_ANTI_RANGE_P (currval) + = VN_INFO (currval)->range_info_anti_range_p; + VN_INFO (currval)->info.range_info = NULL; + } } else if (POINTER_TYPE_P (TREE_TYPE (to)) && SSA_NAME_PTR_INFO (to)) { if (SSA_NAME_IS_DEFAULT_DEF (to) || dominated_by_p_w_unex (gimple_bb (SSA_NAME_DEF_STMT (from)), gimple_bb (SSA_NAME_DEF_STMT (to)))) /* Keep the info from the dominator. */ ;