aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAndrew Pinski <andrew_pinski@playstation.sony.com>2007-04-27 01:31:25 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2007-04-26 18:31:25 -0700
commitd333b74f9446e22d8c35a6713b3934f97e96a8aa (patch)
treea92e160dfec97dc7613b10e65f111c84dce8b678 /gcc
parent45e6714b9a85d47d1ed481b1d27c62528cdd805d (diff)
downloadgcc-d333b74f9446e22d8c35a6713b3934f97e96a8aa.zip
gcc-d333b74f9446e22d8c35a6713b3934f97e96a8aa.tar.gz
gcc-d333b74f9446e22d8c35a6713b3934f97e96a8aa.tar.bz2
re PR c++/30016 (internal compiler error: in convert_move, at expr.c:362)
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/typeck.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/ext/vector6.C12
4 files changed, 24 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 6fea3c6..4bab9ff 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 7e816f1..2b4e065 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -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
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8a0172b..6b7bcc7 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..9caf8c2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/vector6.C
@@ -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 "" }
+}