aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Pinski <pinskia@physics.uc.edu>2006-08-23 02:56:43 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2006-08-22 19:56:43 -0700
commitc846e8cd67a090651ee98d52fb6fbc14a80a4fad (patch)
tree104ca237a73f6dec8df341cec422f6c96656b042
parentbee7c39239d1c02933c01fb65183cd5de12b0e1e (diff)
downloadgcc-c846e8cd67a090651ee98d52fb6fbc14a80a4fad.zip
gcc-c846e8cd67a090651ee98d52fb6fbc14a80a4fad.tar.gz
gcc-c846e8cd67a090651ee98d52fb6fbc14a80a4fad.tar.bz2
re PR c++/28450 (ICE with new and complex/vector types)
2006-08-21 Andrew Pinski <pinskia@physics.uc.edu> PR C++/28450 * cp/init.c (build_zero_init): Handle VECTOR_TYPE and COMPLEX_TYPEs. 2006-08-21 Andrew Pinski <pinskia@physics.uc.edu> PR C++/28450 * g++.dg/ext/vector4.C: New test. * g++.dg/ext/complex1.C: New test. From-SVN: r116341
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/init.c5
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/ext/complex1.C6
-rw-r--r--gcc/testsuite/g++.dg/ext/vector4.C6
5 files changed, 28 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9124177..f50554c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2006-08-22 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR C++/28450
+ * cp/init.c (build_zero_init): Handle VECTOR_TYPE and
+ COMPLEX_TYPEs.
+
2006-08-22 Simon Martin <simartin@users.sourceforge.net>
PR c++/28420
diff --git a/gcc/cp/init.c b/gcc/cp/init.c
index ff6de33..a88d0c0 100644
--- a/gcc/cp/init.c
+++ b/gcc/cp/init.c
@@ -178,7 +178,8 @@ build_zero_init (tree type, tree nelts, bool static_storage_p)
items with static storage duration that are not otherwise
initialized are initialized to zero. */
;
- else if (SCALAR_TYPE_P (type))
+ else if (SCALAR_TYPE_P (type)
+ || TREE_CODE (type) == COMPLEX_TYPE)
init = convert (type, integer_zero_node);
else if (CLASS_TYPE_P (type))
{
@@ -248,6 +249,8 @@ build_zero_init (tree type, tree nelts, bool static_storage_p)
/* Build a constructor to contain the initializations. */
init = build_constructor (type, v);
}
+ else if (TREE_CODE (type) == VECTOR_TYPE)
+ init = fold_convert (type, integer_zero_node);
else
gcc_assert (TREE_CODE (type) == REFERENCE_TYPE);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 502921c..0e58baa 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2006-08-22 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR C++/28450
+ * g++.dg/ext/vector4.C: New test.
+ * g++.dg/ext/complex1.C: New test.
+
2006-08-21 Geoffrey Keating <geoffk@apple.com>
PR debug/28692
diff --git a/gcc/testsuite/g++.dg/ext/complex1.C b/gcc/testsuite/g++.dg/ext/complex1.C
new file mode 100644
index 0000000..ac67711
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/complex1.C
@@ -0,0 +1,6 @@
+/* { dg-options "" } */
+/* { dg-do compile } */
+// Testing if we can do a new of a complex type
+// PR C++/28450
+
+void* q = new __complex__ int ();
diff --git a/gcc/testsuite/g++.dg/ext/vector4.C b/gcc/testsuite/g++.dg/ext/vector4.C
new file mode 100644
index 0000000..e145784
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/vector4.C
@@ -0,0 +1,6 @@
+/* { dg-options "" } */
+/* { dg-do compile } */
+// Testing if we can do a new of a vector
+// PR C++/28450
+
+void* q = new int __attribute__((vector_size(8))) ();