]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/30016 (internal compiler error: in convert_move, at expr.c:362)
authorAndrew Pinski <andrew_pinski@playstation.sony.com>
Fri, 27 Apr 2007 01:31:25 +0000 (01:31 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Fri, 27 Apr 2007 01:31:25 +0000 (18:31 -0700)
2007-04-26  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR C++/30016
        * typeck.c (build_reinterpret_cast_1): Only allow conversion to
        integeral types from vectors types.

2007-04-26  Andrew Pinski  <andrew_pinski@playstation.sony.com>

        PR C++/30016
        * g++.dg/ext/vector6.C: New test.

From-SVN: r124208

gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/vector6.C [new file with mode: 0644]

index 6fea3c6b649f63fa2e35fdc56f9652bab8011369..4bab9ff9a2393d34f24cd6f110ee91ff124a6eeb 100644 (file)
@@ -1,3 +1,9 @@
+2007-04-26  Andrew Pinski  <andrew_pinski@playstation.sony.com>
+
+       PR C++/30016
+       * typeck.c (build_reinterpret_cast_1): Only allow conversion to
+       integeral types from vectors types.
+
 2007-04-26  Jakub Jelinek  <jakub@redhat.com>
 
        PR c++/31598
index 7e816f102f780bf18b73abf7fd94ef662a458a66..2b4e065913c4627b33e1bd6d367147b931d927d6 100644 (file)
@@ -5341,7 +5341,7 @@ build_reinterpret_cast_1 (tree type, tree expr, bool c_cast_p,
     }
   else if (TREE_CODE (type) == VECTOR_TYPE)
     return fold_if_not_in_template (convert_to_vector (type, expr));
-  else if (TREE_CODE (intype) == VECTOR_TYPE)
+  else if (TREE_CODE (intype) == VECTOR_TYPE && INTEGRAL_TYPE_P (type))
     return fold_if_not_in_template (convert_to_integer (type, expr));
   else
     {
index 8a0172b0dfc6a65e4a042c82139c990db70f3334..6b7bcc7d67e82f3274267b12b73da3d8a08737a4 100644 (file)
@@ -1,3 +1,8 @@
+2007-04-26  Andrew Pinski  <andrew_pinski@playstation.sony.com>
+
+       PR C++/30016
+       * g++.dg/ext/vector6.C: New test.
+
 2007-04-26  Kazu Hirata  <kazu@codesourcery.com>
 
        * gcc.c-torture/execute/ieee/20000320-1.x: New.
diff --git a/gcc/testsuite/g++.dg/ext/vector6.C b/gcc/testsuite/g++.dg/ext/vector6.C
new file mode 100644 (file)
index 0000000..9caf8c2
--- /dev/null
@@ -0,0 +1,12 @@
+// { dg-options "" }
+// { dg-do compile }
+// C++/30016, we were allowing conversion between vector types
+// and union types which is invalid.
+
+typedef float __v_4F __attribute__ ((vector_size (16)));
+typedef union {__v_4F v; float a[4];} __v4F;
+void f(void)
+{
+      __v_4F b;
+      (reinterpret_cast<__v4F>(b).a)[1] = 1; // { dg-error "" }
+}
This page took 0.144058 seconds and 5 git commands to generate.