public inbox for jit@gcc.gnu.org
 help / color / mirror / Atom feed
From: Antoni Boucher <bouanto@zoho.com>
To: David Malcolm <dmalcolm@redhat.com>,
	jit@gcc.gnu.org,  gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] libgccjit: Add type checks in gcc_jit_block_add_assignment_op
Date: Sat, 17 Feb 2024 11:54:34 -0500	[thread overview]
Message-ID: <4912f147b48032dc4f5fd741f0ceae1695f2b05f.camel@zoho.com> (raw)
In-Reply-To: <27e7d66dbf130867f16fbb04649cf35c153fe273.camel@zoho.com>

David: Ping.

On Thu, 2023-12-21 at 08:36 -0500, Antoni Boucher wrote:
> Hi.
> Here's the updated patch.
> Thanks.
> 
> On Thu, 2023-12-07 at 20:15 -0500, David Malcolm wrote:
> > On Thu, 2023-12-07 at 17:34 -0500, Antoni Boucher wrote:
> > > Hi.
> > > This patch adds checks gcc_jit_block_add_assignment_op to make
> > > sure
> > > it
> > > is only ever called on numeric types.
> > > 
> > > With the previous patch, this might require a change to also
> > > allow
> > > vector types here.
> > > 
> > > Thanks for the review.
> > 
> > Thanks for the patch.
> > 
> > [...snip...]
> > 
> > > @@ -2890,6 +2900,17 @@ gcc_jit_block_add_assignment_op
> > > (gcc_jit_block *block,
> > >      lvalue->get_type ()->get_debug_string (),
> > >      rvalue->get_debug_string (),
> > >      rvalue->get_type ()->get_debug_string ());
> > > +  // TODO: check if it is a numeric vector?
> > > +  RETURN_IF_FAIL_PRINTF3 (
> > > +    lvalue->get_type ()->is_numeric () && rvalue->get_type ()-
> > > > is_numeric (), ctxt, loc,
> > > +    "gcc_jit_block_add_assignment_op %s has non-numeric lvalue
> > > %s
> > > (type: %s)",
> > > +    gcc::jit::binary_op_reproducer_strings[op],
> > > +    lvalue->get_debug_string (), lvalue->get_type ()-
> > > > get_debug_string ());
> > 
> > The condition being tested here should probably just be:
> > 
> >    lvalue->get_type ()->is_numeric ()
> > 
> > since otherwise if the lvalue's type is numeric and the rvalue's
> > type
> > fails to be, then the user would incorrectly get a message about
> > the
> > lvalue.
> > 
> > > +  RETURN_IF_FAIL_PRINTF3 (
> > > +    rvalue->get_type ()->is_numeric () && rvalue->get_type ()-
> > > > is_numeric (), ctxt, loc,
> > > +    "gcc_jit_block_add_assignment_op %s has non-numeric rvalue
> > > %s
> > > (type: %s)",
> > > +    gcc::jit::binary_op_reproducer_strings[op],
> > > +    rvalue->get_debug_string (), rvalue->get_type ()-
> > > > get_debug_string ());
> > 
> > The condition being tested here seems to have a redundant repeated:
> >   && rvalue->get_type ()->is_numeric ()
> > 
> > Am I missing something, or is that a typo?
> > 
> > [...snip...]
> > 
> > The patch is OK otherwise.
> > 
> > Thanks
> > Dave
> > 
> > 
> > 
> 


      reply	other threads:[~2024-02-17 16:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-07 22:34 Antoni Boucher
2023-12-08  1:15 ` David Malcolm
2023-12-21 13:36   ` Antoni Boucher
2024-02-17 16:54     ` Antoni Boucher [this message]

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=4912f147b48032dc4f5fd741f0ceae1695f2b05f.camel@zoho.com \
    --to=bouanto@zoho.com \
    --cc=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jit@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).