This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Fix failure of ACATS c45503c at -O2
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: Jeff Law <law at redhat dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Joseph Myers <joseph at codesourcery dot com>
- Date: Wed, 21 Oct 2015 11:51:45 +0200
- Subject: Re: [patch] Fix failure of ACATS c45503c at -O2
- Authentication-results: sourceware.org; auth=none
- References: <1990513 dot tXxA4OvBVE at polaris> <alpine dot DEB dot 2 dot 10 dot 1510202157130 dot 9787 at digraph dot polyomino dot org dot uk> <56272531 dot 8080609 at redhat dot com> <1514366 dot LKDlpZBPto at polaris>
On Wed, Oct 21, 2015 at 9:24 AM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> So the only question is whether or not the CEIL_MOD_EXPR and
>> ROUND_MOD_EXPR bits are right. I'm confident the change to
>> FLOOR_MOD_EXPR is right.
>
> OK.
>
>> Do we have any reasonable way to test CEIL_MOD_EXPR & ROUND_MOD_EXPR?
>
> Note that the patch makes the function punt on those 2 so it can do no harm.
> The sign of CEIL_MOD_EXPR is predictable (opposite of that of the divisor) but
> you cannot use that in the context; and finally the sign of ROUND_MOD_EXPR
> isn't predictable.
>
> I can add a few more comments:
Maybe add the comments to tree.def instead.
> Index: fold-const.c
> ===================================================================
> --- fold-const.c (revision 229022)
> +++ fold-const.c (working copy)
> @@ -12982,11 +12982,18 @@ tree_binary_nonnegative_warnv_p (enum tr
> return RECURSE (op0) && RECURSE (op1);
>
> case TRUNC_MOD_EXPR:
> - case CEIL_MOD_EXPR:
> - case FLOOR_MOD_EXPR:
> - case ROUND_MOD_EXPR:
> + /* The sign of the remainder is that of the dividend. */
> return RECURSE (op0);
>
> + case FLOOR_MOD_EXPR:
> + /* The sign of the remainder is that of the divisor. */
> + return RECURSE (op1);
> +
> + case CEIL_MOD_EXPR:
> + /* The sign of the remainder is the opposite of that of the divisor,
> + but this cannot be used in this context. */
> + case ROUND_MOD_EXPR:
> + /* The sign of the remainder is not predictable. */
> default:
> return tree_simple_nonnegative_warnv_p (code, type);
> }
>
>
> --
> Eric Botcazou