Avoid GCC 4.1 build failure in fold-const.c
authorRichard Sandiford <richard.sandiford@linaro.org>
Tue, 16 Jan 2018 12:44:37 +0000 (12:44 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Tue, 16 Jan 2018 12:44:37 +0000 (12:44 +0000)
We had:

      tree t = fold_vec_perm (type, arg1, arg2,
      vec_perm_indices (sel, 2, nelts));

where fold_vec_perm takes a const vec_perm_indices &.  GCC 4.1 apparently
required a public copy constructor:

gcc/vec-perm-indices.h:85: error: 'vec_perm_indices::vec_perm_indices(const vec_perm_indices&)' is private
gcc/fold-const.c:11410: error: within this context

even though no copy should be made here.  This patch tries to work
around that by constructing the vec_perm_indices separately.

2018-01-16  Richard Sandiford  <richard.sandiford@linaro.org>

gcc/
* fold-const.c (fold_ternary_loc): Construct the vec_perm_indices
in a separate statement.

From-SVN: r256740

gcc/ChangeLog
gcc/fold-const.c

index f83d351942ad4d82efcbc3f9fc296b6843caf0b3..99ea694ffcdd57198fb26dd66710f757bb93b94e 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-16  Richard Sandiford  <richard.sandiford@linaro.org>
+
+       * fold-const.c (fold_ternary_loc): Construct the vec_perm_indices
+       in a separate statement.
+
 2018-01-16  Richard Sandiford  <richard.sandiford@linaro.org>
 
        * tree-vect-data-refs.c (vect_analyze_data_ref_accesses):
index f3749db7ed65489eb91cf2313325efa26869b88c..5cf20521daf9b0067212b689a2645df587785673 100644 (file)
@@ -11406,8 +11406,8 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type,
                  else /* Currently unreachable.  */
                    return NULL_TREE;
                }
-             tree t = fold_vec_perm (type, arg1, arg2,
-                                     vec_perm_indices (sel, 2, nelts));
+             vec_perm_indices indices (sel, 2, nelts);
+             tree t = fold_vec_perm (type, arg1, arg2, indices);
              if (t != NULL_TREE)
                return t;
            }