public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Eric Botcazou <ebotcazou@adacore.com>, gcc-patches@gcc.gnu.org
Subject: Re: [patch] Fix failure of ACATS c45503c at -O2
Date: Tue, 20 Oct 2015 19:04:00 -0000	[thread overview]
Message-ID: <56268F8A.1040707@redhat.com> (raw)
In-Reply-To: <1990513.tXxA4OvBVE@polaris>

On 10/20/2015 10:33 AM, Eric Botcazou wrote:
> Hi,
>
> this test started to fail recently as the result of the work of Richard S.,
> but the underlying issue had been latent for a long time.  It boils down to
> this excerpt from the VRP1 dump file:
>
> Found new range for _9: [0, 12]
> marking stmt to be not simulated again
>
> Visiting statement:
> _3 = _9 %[fl] _11;
> Found new range for _3: [0, +INF]
>
> which is plain wrong since the sign of FLOOR_MOD_EXPR is the sign of the
> divisor and not that of the dividend (the latter is for TRUNC_MOD_EXPR).
>
> I have attached a fix for mainline and another one for the 4.9/5 branches.
>
> Tested on x86_64-suse-linux, OK for all active branches?
>
>
> 2015-10-20  Eric Botcazou  <ebotcazou@adacore.com>
>
> 	* fold-const.c (tree_binary_nonnegative_warnv_p) <FLOOR_MOD_EXPR>:
> 	Recurse on operand #1 instead of operand #0.
> 	<CEIL_MOD_EXPR>: Do not recurse.
> 	<ROUND_MOD_EXPR>: Likewise.
Isn't this a function of the language and in some cases isn't it 
implementation defined (true for C/C++ until C++11)?

Even with that in mind, I think FLOOR_MOD_EXPR and TRUNC_MOD_EXPR are 
more correct with your patch.  I'm just not sure about CEIL & ROUND.

Jeff

  reply	other threads:[~2015-10-20 19:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-20 16:38 Eric Botcazou
2015-10-20 19:04 ` Jeff Law [this message]
2015-10-20 22:10   ` Joseph Myers
2015-10-21  5:57     ` Jeff Law
2015-10-21  7:50       ` Eric Botcazou
2015-10-21  9:56         ` Richard Biener
2015-10-21 13:15           ` Eric Botcazou
2015-10-21 13:18             ` Richard Biener
2015-10-21 21:11             ` Richard Sandiford
2015-10-20 22:30   ` Eric Botcazou
2015-10-20 22:55     ` Joseph Myers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56268F8A.1040707@redhat.com \
    --to=law@redhat.com \
    --cc=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).