diff mbox

use build_vector_from_val in more places

Message ID 20101031213413.GG6758@nightcrawler
State New
Headers show

Commit Message

Nathan Froyd Oct. 31, 2010, 9:34 p.m. UTC
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:
> 
> $ <path>/gcc/xgcc -B <path>/gcc -O2 -flto -ftree-vectorize -c pr45720.c
> $ <path>/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.

Comments

Richard Biener Nov. 1, 2010, 10:20 p.m. UTC | #1
On Sun, Oct 31, 2010 at 10:34 PM, Nathan Froyd <froydnj@codesourcery.com> wrote:
> 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:
>>
>> $ <path>/gcc/xgcc -B <path>/gcc -O2 -flto -ftree-vectorize -c pr45720.c
>> $ <path>/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?

Please use types_compatible_p instead.

Ok with that change,
Richard.

> -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)
>
diff mbox

Patch

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)