Commit 6f11ddd8 by Jason Merrill Committed by Jason Merrill

PR c++/84424 - ICE with constexpr and __builtin_shuffle.

	* constexpr.c (reduced_constant_expression_p): Handle CONSTRUCTOR of
	VECTOR_TYPE.

From-SVN: r257924
parent 8304bcf2
2018-02-22 Jason Merrill <jason@redhat.com>
PR c++/84424 - ICE with constexpr and __builtin_shuffle.
* constexpr.c (reduced_constant_expression_p): Handle CONSTRUCTOR of
VECTOR_TYPE.
2018-02-22 Marek Polacek <polacek@redhat.com>
PR c++/84493
......
......@@ -1763,7 +1763,13 @@ reduced_constant_expression_p (tree t)
/* And we need to handle PTRMEM_CST wrapped in a CONSTRUCTOR. */
tree idx, val, field; unsigned HOST_WIDE_INT i;
if (CONSTRUCTOR_NO_IMPLICIT_ZERO (t))
field = next_initializable_field (TYPE_FIELDS (TREE_TYPE (t)));
{
if (TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
/* An initialized vector would have a VECTOR_CST. */
return false;
else
field = next_initializable_field (TYPE_FIELDS (TREE_TYPE (t)));
}
else
field = NULL_TREE;
FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (t), i, idx, val)
......
// PR c++/84424
// { dg-do compile { target c++11 } }
// { dg-options "" }
typedef int vec __attribute__ ((vector_size (2 * sizeof (int))));
constexpr vec u = { 1, 2 };
constexpr vec v = __builtin_shuffle (v, u); // { dg-error "" }
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