Avoid GCC 4.1 build failure in fold-const.c

Message ID 87bmhuxatr.fsf@linaro.org
State New
Headers show
Series
  • Avoid GCC 4.1 build failure in fold-const.c
Related show

Commit Message

Richard Sandiford Jan. 16, 2018, 12:11 p.m.
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.

Tested on aarch64-linux-gnu.  OK to install?

Richard


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.

Comments

Jakub Jelinek Jan. 16, 2018, 12:12 p.m. | #1
On Tue, Jan 16, 2018 at 12:11:28PM +0000, Richard Sandiford wrote:
> 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.

> 

> Tested on aarch64-linux-gnu.  OK to install?

> 

> Richard

> 

> 

> 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.


Ok, thanks.

> Index: gcc/fold-const.c

> ===================================================================

> --- gcc/fold-const.c	2018-01-15 12:38:28.967896418 +0000

> +++ gcc/fold-const.c	2018-01-16 12:08:10.082222501 +0000

> @@ -11406,8 +11406,8 @@ fold_ternary_loc (location_t loc, enum t

>  		  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;

>  	    }


	Jakub

Patch

Index: gcc/fold-const.c
===================================================================
--- gcc/fold-const.c	2018-01-15 12:38:28.967896418 +0000
+++ gcc/fold-const.c	2018-01-16 12:08:10.082222501 +0000
@@ -11406,8 +11406,8 @@  fold_ternary_loc (location_t loc, enum t
 		  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;
 	    }