From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12464 invoked by alias); 14 Mar 2011 10:43:35 -0000 Received: (qmail 12456 invoked by uid 22791); 14 Mar 2011 10:43:34 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 14 Mar 2011 10:43:31 +0000 From: "rguenth at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.6.0 X-Bugzilla-Changed-Fields: Status AssignedTo Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Mon, 14 Mar 2011 10:43:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-03/txt/msg01384.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48098 Richard Guenther 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 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.