------- Comment #6 from jakub at gcc dot gnu dot org 2008-09-30 10:03 ------- For -fwrapv I wonder why we add TREE_OVERFLOW at all. force_fit_type_double does:
/* Size types *are* sign extended. */ sign_extended_type = (!TYPE_UNSIGNED (type) || (TREE_CODE (type) == INTEGER_TYPE && TYPE_IS_SIZETYPE (type))); overflow = fit_double_type (low, high, &low, &high, type); /* If we need to set overflow flags, return a new unshared node. */ if (overflowed || overflow) { if (overflowed || overflowable < 0 || (overflowable > 0 && sign_extended_type)) { tree t = make_node (INTEGER_CST); TREE_INT_CST_LOW (t) = low; TREE_INT_CST_HIGH (t) = high; TREE_TYPE (t) = type; TREE_OVERFLOW (t) = 1; return t; } } but as with -fwrapv signed overflow is defined, I'd say we should clear sign_extended_type if flag_wrapv (or add " && !flag_wrapv" to the overflowable > 0 condition). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37664