From patchwork Sun Oct 31 21:34:14 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: use build_vector_from_val in more places Date: Sun, 31 Oct 2010 11:34:14 -0000 From: Nathan Froyd X-Patchwork-Id: 69740 Message-Id: <20101031213413.GG6758@nightcrawler> To: Uros Bizjak Cc: gcc-patches@gcc.gnu.org, Diego Novillo On Sun, Oct 31, 2010 at 09:51:41AM +0100, Uros Bizjak wrote: > > The recently-introduced build_vector_from_val function can be used in > > several places, centralizing TREE_LIST use and making it easier to > > remove at a later point. The assertion change in build_vector_from_val > > is needed so as to not ICE while building libgfortran and is, I think, > > more correct in any event. > > This patch caused a regression on x86_64-pc-linux-gnu [1]: > > FAIL: gcc.dg/torture/pr45720.c -O2 -flto (internal compiler error) > FAIL: gcc.dg/torture/pr45720.c -O2 -flto (test for excess errors) > FAIL: gcc.dg/torture/pr45720.c -O2 -fwhopr (internal compiler error) > FAIL: gcc.dg/torture/pr45720.c -O2 -fwhopr (test for excess errors) > > You can trigger this ICE using following command sequence: > > $ /gcc/xgcc -B /gcc -O2 -flto -ftree-vectorize -c pr45720.c > $ /gcc/lto1 -O2 -ftree-vectorize -quiet pr45720.o Whoops! Apologies for the breakage. I think this is because there is no types_compatible_p hook for LTO, which makes sense. The below patch makes the assert use useless_type_conversion_p instead. Third time's the charm for such a simple assert... The patch fixes the above ICEs. Full testing in progress on x86_64-unknown-linux-gnu. OK to commit? -Nathan * tree.c (build_vector_from_val): Use useless_type_conversion_p. diff --git a/gcc/tree.c b/gcc/tree.c index 4de73ee..a746031 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1376,8 +1376,8 @@ build_vector_from_val (tree vectype, tree sc) if (sc == error_mark_node) return sc; - gcc_assert (lang_hooks.types_compatible_p (TREE_TYPE (sc), - TREE_TYPE (vectype))); + gcc_assert (useless_type_conversion_p (TREE_TYPE (sc), + TREE_TYPE (vectype))); v = VEC_alloc (constructor_elt, gc, nunits); for (i = 0; i < nunits; ++i)