Commit 4939c5f3 by Marc Glisse Committed by Marc Glisse

re PR c++/59378 (Internal compiler error when using __builtin_shuffle in a template function)

2014-01-02  Marc Glisse  <marc.glisse@inria.fr>

	PR c++/59378
gcc/cp/
	* typeck.c (build_x_vec_perm_expr): Handle non-dependent arguments
	in templates.
gcc/testsuite/
	* g++.dg/ext/pr59378.C: New file.

From-SVN: r206300
parent f82356d2
2014-01-02 Marc Glisse <marc.glisse@inria.fr>
PR c++/59378
* typeck.c (build_x_vec_perm_expr): Handle non-dependent arguments
in templates.
2014-01-02 Richard Sandiford <rdsandiford@googlemail.com> 2014-01-02 Richard Sandiford <rdsandiford@googlemail.com>
Update copyright years Update copyright years
......
...@@ -4944,12 +4944,25 @@ build_x_vec_perm_expr (location_t loc, ...@@ -4944,12 +4944,25 @@ build_x_vec_perm_expr (location_t loc,
tree arg0, tree arg1, tree arg2, tree arg0, tree arg1, tree arg2,
tsubst_flags_t complain) tsubst_flags_t complain)
{ {
if (processing_template_decl tree orig_arg0 = arg0;
&& (type_dependent_expression_p (arg0) tree orig_arg1 = arg1;
tree orig_arg2 = arg2;
if (processing_template_decl)
{
if (type_dependent_expression_p (arg0)
|| type_dependent_expression_p (arg1) || type_dependent_expression_p (arg1)
|| type_dependent_expression_p (arg2))) || type_dependent_expression_p (arg2))
return build_min_nt_loc (loc, VEC_PERM_EXPR, arg0, arg1, arg2); return build_min_nt_loc (loc, VEC_PERM_EXPR, arg0, arg1, arg2);
return c_build_vec_perm_expr (loc, arg0, arg1, arg2, complain & tf_error); arg0 = build_non_dependent_expr (arg0);
if (arg1)
arg1 = build_non_dependent_expr (arg1);
arg2 = build_non_dependent_expr (arg2);
}
tree exp = c_build_vec_perm_expr (loc, arg0, arg1, arg2, complain & tf_error);
if (processing_template_decl && exp != error_mark_node)
return build_min_non_dep (VEC_PERM_EXPR, exp, orig_arg0,
orig_arg1, orig_arg2);
return exp;
} }
/* Return a tree for the sum or difference (RESULTCODE says which) /* Return a tree for the sum or difference (RESULTCODE says which)
......
2014-01-02 Marc Glisse <marc.glisse@inria.fr>
PR c++/59378
* g++.dg/ext/pr59378.C: New file.
2014-01-02 Richard Sandiford <rdsandiford@googlemail.com> 2014-01-02 Richard Sandiford <rdsandiford@googlemail.com>
Update copyright years Update copyright years
......
// { dg-do compile }
typedef int v4si __attribute__ ((vector_size (4*sizeof(int))));
template<int C>
void traverse(v4si& bounds){
v4si m = {0,1,2,3};
bounds = __builtin_shuffle(bounds, m);
}
template void traverse<0>(v4si&);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment