]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/28450 (ICE with new and complex/vector types)
authorAndrew Pinski <pinskia@physics.uc.edu>
Wed, 11 Oct 2006 03:10:25 +0000 (03:10 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Wed, 11 Oct 2006 03:10:25 +0000 (20:10 -0700)
2006-10-10  Andrew Pinski  <pinskia@physics.uc.edu>

        PR C++/28450
        * cp/init.c (build_zero_init): Handle VECTOR_TYPE and
        COMPLEX_TYPEs.

2006-10-10  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: r117627

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 8288aa3b160788fc5494411476dc074fef048cf5..2323905c53407447d82f403fd892962651e88e3d 100644 (file)
@@ -1,3 +1,9 @@
+2006-10-10  Andrew Pinski  <pinskia@physics.uc.edu>
+
+       PR C++/28450
+       * cp/init.c (build_zero_init): Handle VECTOR_TYPE and
+       COMPLEX_TYPEs.
+
 2006-10-09  Andrew Pinski  <pinskia@physics.uc.edu>
 
        PR C++/28349
index 5f22741e48f4864ff5ab8a5f0faaca2919a61bc4..95026fd51a6b16fc9c079cf7e446e994b95905ea 100644 (file)
@@ -179,7 +179,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)
       
       CONSTRUCTOR_ELTS (init) = nreverse (inits);
     }
+  else if (TREE_CODE (type) == VECTOR_TYPE)
+    init = fold_convert (type, integer_zero_node);
   else
     gcc_assert (TREE_CODE (type) == REFERENCE_TYPE);
 
index 3fa5a85d7778621cf83b749dfaf25cfbf119ae05..fa28b43ae3157263e54f5bed33bed35bae41d845 100644 (file)
@@ -1,3 +1,9 @@
+2006-10-10  Andrew Pinski  <pinskia@physics.uc.edu>
+
+       PR C++/28450
+       * g++.dg/ext/vector4.C: New test.
+       * g++.dg/ext/complex1.C: New test.
+
 2006-10-09  Andrew Pinski  <pinskia@physics.uc.edu>
 
        PR c++/28349
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))) ();