On Mon, Jun 23, 2014 at 10:18:16AM +0200, Richard Biener wrote: > > --- a/gcc/tree-ssa-math-opts.c > > +++ b/gcc/tree-ssa-math-opts.c > > @@ -1741,6 +1741,8 @@ find_bswap_1 (gimple stmt, struct symbolic_number *n, > > int limit) > > if (n->size % BITS_PER_UNIT != 0) > > return NULL_TREE; > > n->size /= BITS_PER_UNIT; > > + if (n->size > (int)sizeof (unsigned HOST_WIDEST_INT)) > > + return NULL_TREE;
This looks wrong, while the bswap pass is guarded with BITS_PER_UNIT == 8 check (i.e. target), you don't know of HOST_BITS_PER_CHAR is 8. I'd move the test before the division by BITS_PER_UNIT, and compare against HOST_BITS_PER_WIDEST_INT. > > n->n = (sizeof (HOST_WIDEST_INT) < 8 ? 0 : > > (unsigned HOST_WIDEST_INT)0x08070605 << 32 | 0x04030201); > > > > @@ -1781,6 +1783,8 @@ find_bswap_1 (gimple stmt, struct symbolic_number *n, > > int limit) > > type_size = TYPE_PRECISION (gimple_expr_type (stmt)); > > if (type_size % BITS_PER_UNIT != 0) > > return NULL_TREE; > > + if (type_size > (int)HOST_BITS_PER_WIDEST_INT) > > + return NULL_TREE; > > > > if (type_size / BITS_PER_UNIT < (int)(sizeof (HOST_WIDEST_INT))) > > { Similarly here. BTW, the formatting is wrong too, the (int) cast should be followed by space. Jakub