[PATCH] Adjust gimple-ssa-sprintf.c for irange API.

Aldy Hernandez aldyh@redhat.com
Tue Aug 4 14:11:35 GMT 2020

On Tue, Aug 4, 2020 at 3:59 PM Martin Sebor <msebor@gmail.com> wrote:
> On 8/4/20 5:21 AM, Aldy Hernandez via Gcc-patches wrote:
> > This is a rather obvious patch, but I'd like a nod before committing.
> >
> > Martin, I've removed your anti-range check, as it is subsumed by the
> > lower_bound/upper_bound code.  However, you will have to adapt the code
> > for multi-ranges if desired.  For example, you may want to loop through the
> > sub-ranges and do the right thing.  Look at value-range.h and see the comments
> > for class irange.  Those are the methods you should stick to.
> >
> > i.e.
> >       for (i=0; i < vr->num_pairs(); ++i)
> >               stuff_with(vr->lower_bound(i), vr->upper_bound(i))
> >
> > There should be no functional changes with this patch.
> I have no concern with this change but I appreciate the heads
> up and the tip on how to add the multi-range support.  Just
> one suggestion: I'd prefer to keep the comment about the POSIX
> requirement somewhere just as a reminder.

The comment is still there, as you had a duplicate one further up:

 else if (dstsize > target_int_max ())
          warning_at (gimple_location (info.callstmt), info.warnopt (),
              "specified bound %wu exceeds %<INT_MAX%>",
          /* POSIX requires snprintf to fail if DSTSIZE is greater
         than INT_MAX.  Avoid folding in that case.  */
          posunder4k = false;

Are you ok with this, or would you rather me copy that comment somewhere else?


More information about the Gcc-patches mailing list