public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/48098] [4.6 Regression] internal compiler error: in build_vector_from_val, at tree.c:1380
Date: Mon, 14 Mar 2011 10:43:00 -0000	[thread overview]
Message-ID: <bug-48098-4-n1w7pHxaCj@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-48098-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48098

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |rguenth at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #6 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-03-14 10:43:09 UTC ---
(In reply to comment #5)
> Just swapping the order of arguments to useless_type_conversion_p works too.
> If we consider build_vector_from_val as conversion from sc's type to the inner
> type of the vector, then vectype's inner type as outer_type needs to go first:
> 
> --- gcc/tree.c.jj    2011-03-11 12:16:39.000000000 +0100
> +++ gcc/tree.c    2011-03-14 10:57:21.000000000 +0100
> @@ -1376,8 +1376,8 @@ build_vector_from_val (tree vectype, tre
>    if (sc == error_mark_node)
>      return sc;
> 
> -  gcc_assert (useless_type_conversion_p (TREE_TYPE (sc),
> -                     TREE_TYPE (vectype)));
> +  gcc_assert (useless_type_conversion_p (TREE_TYPE (vectype),
> +                     TREE_TYPE (sc)));
> 
>    v = VEC_alloc (constructor_elt, gc, nunits);
>    for (i = 0; i < nunits; ++i)

The assert is supposed to make sure that in vectorized code vector extracts
use the correct type for assignments to scalars.  Thus if we have before
vectorization

  scalar = X;

and we vectorized the code that produced X we should use a vector type
for the vector result X that has an element type that is trivially
convertible to that of the above scalar.  Thus, before and after
vectorization

  useless_type_conversion_p (type-of-scalar, type-of-vector-element-type)

should be true.  The scalar X is sc above which is trivially convertible
to scalar, so if type-of-vector-element-type is trivially convertible to
X then it's trivially convertible to scalar.

Thus the assert is correct.

I think treating restrict as ordinary qualifier in make_vector_type is
bogus, similarly not properly maintaining a ref-all "qualification".
I suppose nobody thought of pointer vector element types before.

I'll cook up a patch.


  parent reply	other threads:[~2011-03-14 10:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-12 22:48 [Bug tree-optimization/48098] New: " schnetter at gmail dot com
2011-03-12 23:30 ` [Bug tree-optimization/48098] " schnetter at gmail dot com
2011-03-14  9:21 ` [Bug tree-optimization/48098] [4.6 Regression] " jakub at gcc dot gnu.org
2011-03-14  9:29 ` jakub at gcc dot gnu.org
2011-03-14  9:38 ` jakub at gcc dot gnu.org
2011-03-14  9:38 ` jakub at gcc dot gnu.org
2011-03-14  9:39 ` jakub at gcc dot gnu.org
2011-03-14  9:59 ` jakub at gcc dot gnu.org
2011-03-14 10:43 ` rguenth at gcc dot gnu.org [this message]
2011-03-14 10:51 ` rguenth at gcc dot gnu.org
2011-03-14 10:58 ` rguenth at gcc dot gnu.org
2011-03-14 12:22 ` rguenth at gcc dot gnu.org
2011-03-14 12:35 ` rguenth at gcc dot gnu.org

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=bug-48098-4-n1w7pHxaCj@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).