OSDN Git Service

2006-08-21 Andrew Pinski <pinskia@physics.uc.edu>
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 23 Aug 2006 02:56:43 +0000 (02:56 +0000)
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 23 Aug 2006 02:56:43 +0000 (02:56 +0000)
        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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116341 138bc75d-0d04-0410-961f-82ee72b054a4

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 9124177..f50554c 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 ff6de33..a88d0c0 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 502921c..0e58baa 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))) ();