re PR c++/23337 (ICE initializing array of vectors in C++)

./	PR c++/23337
	* gimplify.c (gimplify_init_ctor_eval): If we see an element of
	vector type, don't try to construct it element by element.  Add an
	assertion that we use a FIELD_DECL when building a COMPONENT_REF.
testsuite/
	PR c++/23337
	* g++.dg/ext/vector2.C: New.

From-SVN: r103177
This commit is contained in:
Ian Lance Taylor 2005-08-16 22:07:44 +00:00 committed by Ian Lance Taylor
parent 3a69437a55
commit cf0efa6a76
4 changed files with 31 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2005-08-16 Ian Lance Taylor <ian@airs.com>
PR c++/23337
* gimplify.c (gimplify_init_ctor_eval): If we see an element of
vector type, don't try to construct it element by element. Add an
assertion that we use a FIELD_DECL when building a COMPONENT_REF.
2005-08-16 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
* fold-const.c (fold_ternary): Simplify folding of a CALL_EXPR.

View File

@ -2593,10 +2593,14 @@ gimplify_init_ctor_eval (tree object, VEC(constructor_elt,gc) *elts,
purpose, NULL_TREE, NULL_TREE);
}
else
cref = build (COMPONENT_REF, TREE_TYPE (purpose),
unshare_expr (object), purpose, NULL_TREE);
{
gcc_assert (TREE_CODE (purpose) == FIELD_DECL);
cref = build (COMPONENT_REF, TREE_TYPE (purpose),
unshare_expr (object), purpose, NULL_TREE);
}
if (TREE_CODE (value) == CONSTRUCTOR)
if (TREE_CODE (value) == CONSTRUCTOR
&& TREE_CODE (TREE_TYPE (value)) != VECTOR_TYPE)
gimplify_init_ctor_eval (cref, CONSTRUCTOR_ELTS (value),
pre_p, cleared);
else

View File

@ -1,3 +1,8 @@
2005-08-16 Ian Lance Taylor <ian@airs.com>
PR c++/23337
* g++.dg/ext/vector2.C: New.
2005-08-16 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/23428

View File

@ -0,0 +1,12 @@
// PR c++/23337; caused an ICE in component_ref_field_offset
// { dg-options "" }
// { dg-options "-mmmx" { target { i?86-*-* && ilp32 } } } */
// { dg-options "-mmmx" { target { x86_64-*-* && ilp32 } } } */
typedef int vec __attribute__ ((vector_size (8)));
extern int bar (vec);
int
foo (int i)
{
vec a[] = { (vec) { 0, i }, (vec) { 4, 5 } };
return bar (a[0]) + bar (a[1]);
}