re PR c++/28450 (ICE with new and complex/vector types)
authorAndrew Pinski <pinskia@physics.uc.edu>
Wed, 23 Aug 2006 02:56:43 +0000 (02:56 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Wed, 23 Aug 2006 02:56:43 +0000 (19:56 -0700)
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

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

index 912417794628bee94629964ee3415eca4d5af609..f50554cab565becfd4a3bfd33ff0aca2ccd106d7 100644 (file)
@@ -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
index ff6de3360e5cc7885cfb6a30ed3d3ce42abb17b9..a88d0c067038a92065f9b44fa8a84a11f25efc97 100644 (file)
@@ -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);
 
index 502921ce67946a28587aa4d3f20be10756148ba1..0e58baab765cd573720edcb5d7ad862051c58e09 100644 (file)
@@ -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 (file)
index 0000000..ac67711
--- /dev/null
@@ -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 (file)
index 0000000..e145784
--- /dev/null
@@ -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))) ();