public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Marc Glisse <marc.glisse@inria.fr>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [C++] Mixed scalar-vector operations
Date: Fri, 05 Oct 2012 21:47:00 -0000	[thread overview]
Message-ID: <506F5563.2070701@redhat.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1209212007140.10009@stedding.saclay.inria.fr>

On 09/21/2012 02:32 PM, Marc Glisse wrote:
> +  gcc_assert (TREE_CODE (type0) == VECTOR_TYPE
> +	      || TREE_CODE (type1) == VECTOR_TYPE);
> +  switch (code)
> +    {
> +      case RSHIFT_EXPR:
> +      case LSHIFT_EXPR:
> +	if (TREE_CODE (type0) == INTEGER_TYPE
> +	    && TREE_CODE (TREE_TYPE (type1)) == INTEGER_TYPE)

Here you're asserting that one of the types is a vector and then 
assuming that type1 is a vector and type0 is not.  I guess you need to 
move the swapping code out of the switch.

> +		error_at (loc, "conversion of scalar to vector "
> +			       "involves truncation");

These errors should print the types involved.  They also need to be 
suppressed when !(complain & tf_error).

> +              op0 = convert (TREE_TYPE (type1), op0);
> +              op0 = build_vector_from_val (type1, op0);

I don't see anything in cp_build_binary_op that makes sure that the 
VECTOR_TYPE is in type1.

Jason

  parent reply	other threads:[~2012-10-05 21:47 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-21 20:08 Marc Glisse
2012-10-05 19:53 ` Marc Glisse
2012-10-05 21:47 ` Jason Merrill [this message]
2012-10-05 23:09   ` Marc Glisse
2012-10-06  6:05     ` Jason Merrill
2012-10-08 15:54   ` Marc Glisse
2012-10-08 17:49     ` Jason Merrill
2012-10-08 18:13     ` Mike Stump

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=506F5563.2070701@redhat.com \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=marc.glisse@inria.fr \
    /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).