c++: Use fold_non_dependent_expr rather than maybe_constant_value in __builtin_shufflevector handling [PR106001]
In this case the STATIC_CAST_EXPR expressions in the call aren't type nor value dependent, but maybe_constant_value still ICEs on those when processing_template_decl. Calling fold_non_dependent_expr on it instead fixes the ICE and folds them to INTEGER_CSTs. 2022-06-17 Jakub Jelinek <jakub@redhat.com> PR c++/106001 * typeck.cc (build_x_shufflevector): Use fold_non_dependent_expr instead of maybe_constant_value. * g++.dg/ext/builtin-shufflevector-4.C: New test.
This commit is contained in:
parent
cc378e6557
commit
a284fadcce
2 changed files with 19 additions and 1 deletions
|
@ -6344,7 +6344,7 @@ build_x_shufflevector (location_t loc, vec<tree, va_gc> *args,
|
|||
auto_vec<tree, 16> mask;
|
||||
for (unsigned i = 2; i < args->length (); ++i)
|
||||
{
|
||||
tree idx = maybe_constant_value ((*args)[i]);
|
||||
tree idx = fold_non_dependent_expr ((*args)[i], complain);
|
||||
mask.safe_push (idx);
|
||||
}
|
||||
tree exp = c_build_shufflevector (loc, arg0, arg1, mask, complain & tf_error);
|
||||
|
|
18
gcc/testsuite/g++.dg/ext/builtin-shufflevector-4.C
Normal file
18
gcc/testsuite/g++.dg/ext/builtin-shufflevector-4.C
Normal file
|
@ -0,0 +1,18 @@
|
|||
// PR c++/106001
|
||||
// { dg-do compile }
|
||||
|
||||
typedef int V __attribute__((vector_size (2 * sizeof (int))));
|
||||
|
||||
template <int>
|
||||
void
|
||||
foo ()
|
||||
{
|
||||
V v = {};
|
||||
v = __builtin_shufflevector (v, v, static_cast<char>(1), static_cast<char>(0));
|
||||
}
|
||||
|
||||
void
|
||||
bar ()
|
||||
{
|
||||
foo <0> ();
|
||||
}
|
Loading…
Add table
Reference in a new issue