https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92433

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Segher Boessenkool from comment #5)
>   if (y)
>     {
>       gcc_assert (n == 3);
>       std::swap (arg_type[1], arg_type[2]);
>     }
> 
> 
> ?

gcc_assert will work too unless the host compiler is older than 4.5 (or is
clang), but I think we don't really make -Werror on in that case, at least not
by default (only in second stage that is built with trunk gcc already).
So, I can bootstrap/regtest:
2019-11-11  Jakub Jelinek  <ja...@redhat.com>

        PR bootstrap/92433
        * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Add
        assertion that n is 3 for ALTIVEC_BUILTIN_VEC_VCMPGE_P.  Use
        std::swap.

--- gcc/config/rs6000/rs6000-c.c.jj     2019-08-27 12:26:30.115019661 +0200
+++ gcc/config/rs6000/rs6000-c.c        2019-11-11 15:03:57.299102261 +0100
@@ -6080,10 +6080,10 @@ altivec_build_resolved_builtin (tree *ar
       && desc->overloaded_code != ALTIVEC_BUILTIN_VCMPGEFP_P
       && desc->overloaded_code != VSX_BUILTIN_XVCMPGEDP_P)
     {
-      tree t;
-      t = args[2], args[2] = args[1], args[1] = t;
-      t = arg_type[2], arg_type[2] = arg_type[1], arg_type[1] = t;
-      
+      gcc_assert (n == 3);
+      std::swap (args[1], args[2]);
+      std::swap (arg_type[1], arg_type[2]);
+
       args[0] = fold_build2 (BIT_XOR_EXPR, TREE_TYPE (args[0]), args[0],
                             build_int_cst (NULL_TREE, 2));
     }

too if you prefer it that way.  Richi said on IRC he prefers a rs6000-c.c
change in this case.

Reply via email to