OSDN Git Service

./
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 16 Aug 2005 22:07:44 +0000 (22:07 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 16 Aug 2005 22:07:44 +0000 (22:07 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103177 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/vector2.C [new file with mode: 0644]

index 2b40c63..e010e78 100644 (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.
index a1ef22e..41ca3b3 100644 (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
index 179e2dc..043d4c7 100644 (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
diff --git a/gcc/testsuite/g++.dg/ext/vector2.C b/gcc/testsuite/g++.dg/ext/vector2.C
new file mode 100644 (file)
index 0000000..d93257b
--- /dev/null
@@ -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]);
+}