This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PR c/8068
On Fri, Feb 14, 2003 at 11:36:04PM +0100, Arend Bayer wrote:
> +++ gcc/fold-const.c 14 Feb 2003 22:08:53 -0000
> @@ -4693,6 +4693,14 @@ extract_muldiv (t, c, code, wide_type)
> && integer_zerop (const_binop (TRUNC_MOD_EXPR, op1, c, 0)))
> return omit_one_operand (type, integer_zero_node, op0);
>
> + /* We sort op0 and op1 so that op0 is the easier one. */
> + if (TREE_CODE(op1) == INTEGER_CST && TREE_CODE(op0) != INTEGER_CST)
> + {
> + tree tmp = op0;
> + op0 = op1;
> + op1 = tmp;
> + }
> +
> /* ... fall through ... */
>
> case TRUNC_DIV_EXPR: case CEIL_DIV_EXPR: case FLOOR_DIV_EXPR:
The problem also occurs for TRUNC_DIV_EXPR, etc.