public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Martin Sebor <msebor@gmail.com>
Cc: Jeff Law <law@redhat.com>, Gcc Patch List <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] use zero as the lower bound for a signed-unsigned range (PR 79327)
Date: Thu, 02 Feb 2017 23:23:00 -0000	[thread overview]
Message-ID: <20170202232344.GA14051@tucnak> (raw)
In-Reply-To: <f747d504-927d-57dc-9a30-47156f04aba2@gmail.com>

On Thu, Feb 02, 2017 at 12:59:11PM -0700, Martin Sebor wrote:
> > > -  T (2, "%#hho",        a);     /* { dg-warning "nul past the end" } */
> > > -  T (2, "%#hhx",        a);     /* { dg-warning ".%#hhx. directive
> > > writing between 3 and . bytes into a region of size 2" } */
> > > +  T (2, "%#hho",        a);
> > > +  T (2, "%#hhx",        a);
> 
> On reflection, this isn't quite the right fix.  We want to both set
> the correct range and warn because the call will likely overflow.
> This is an example of why the likely/unlikely counters have been
> introduced.  By setting min = 1 and likely = 2 for the %#hho and
> 3 for the %#hhx we get the desired result.

Then please first define what should likely mean and document that.

That is unrelated to the patch, both in the current trunk, with your
patch as well as with my patch there is just
  res.range.likely = res.knownrange ? res.range.max : res.range.min;
  res.range.unlikely = res.range.max;
for these cases.

Do you want likely 2 because that the shortest length for more than
one value (only a single value has the shortest length)?
Something else?

	Jakub

  reply	other threads:[~2017-02-02 23:23 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-01 23:52 Martin Sebor
2017-02-02  7:37 ` Jakub Jelinek
2017-02-02  9:52   ` Jakub Jelinek
2017-02-02 14:12     ` Jakub Jelinek
2017-02-03 18:44       ` Jeff Law
2017-02-03 19:02         ` Jakub Jelinek
2017-02-02 16:58     ` Martin Sebor
2017-02-02 19:59       ` Martin Sebor
2017-02-02 23:23         ` Jakub Jelinek [this message]
2017-02-03  0:50           ` Martin Sebor
2017-02-03 19:07             ` Jeff Law
2017-02-03  0:31         ` Martin Sebor
2017-02-03  0:48           ` Jakub Jelinek
2017-02-03  5:37           ` Martin Sebor
2017-02-03 19:02           ` Jeff Law
2017-02-03 19:08             ` Martin Sebor
2017-02-02 22:15       ` Jakub Jelinek
2017-02-03 18:53         ` Jeff Law
2017-02-03  7:35       ` Jeff Law
2017-02-03 16:13         ` Martin Sebor
2017-02-03 16:39           ` Jakub Jelinek
2017-02-03 17:02             ` Martin Sebor
2017-02-03 17:17               ` Jakub Jelinek
2017-02-03 17:49             ` Jeff Law
2017-02-04  8:07             ` Jakub Jelinek
2017-02-06 19:45               ` Jakub Jelinek
2017-02-14  0:15               ` Jeff Law
2017-02-14  7:48                 ` Jakub Jelinek
2017-02-14 13:57                   ` Jakub Jelinek
2017-02-16 23:22                     ` Jeff Law
2017-02-14 16:37                   ` Martin Sebor
2017-02-14 16:40                     ` Jakub Jelinek
2017-02-14 19:24                       ` Martin Sebor
2017-02-14 20:59                         ` Jakub Jelinek
2017-02-14 22:17                           ` Martin Sebor
2017-02-16 23:34                           ` Jeff Law

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=20170202232344.GA14051@tucnak \
    --to=jakub@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    --cc=msebor@gmail.com \
    /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).