------- Comment #2 from pinskia at gcc dot gnu dot org 2007-07-05 19:02 ------- This patch works for me: Index: fold-const.c =================================================================== --- fold-const.c (revision 126338) +++ fold-const.c (working copy) @@ -282,14 +282,8 @@ HOST_WIDE_INT high, int overflowable, bool overflowed) { - int sign_extended_type; bool overflow;
- /* 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. */ @@ -297,7 +291,7 @@ { if (overflowed || overflowable < 0 - || (overflowable > 0 && sign_extended_type)) + || (overflowable > 0 && !TYPE_UNSIGNED (type))) { tree t = make_node (INTEGER_CST); TREE_INT_CST_LOW (t) = low; -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32628