From c846e8cd67a090651ee98d52fb6fbc14a80a4fad Mon Sep 17 00:00:00 2001 From: Andrew Pinski Date: Wed, 23 Aug 2006 02:56:43 +0000 Subject: [PATCH] re PR c++/28450 (ICE with new and complex/vector types) 2006-08-21 Andrew Pinski PR C++/28450 * cp/init.c (build_zero_init): Handle VECTOR_TYPE and COMPLEX_TYPEs. 2006-08-21 Andrew Pinski PR C++/28450 * g++.dg/ext/vector4.C: New test. * g++.dg/ext/complex1.C: New test. From-SVN: r116341 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/init.c | 5 ++++- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/ext/complex1.C | 6 ++++++ gcc/testsuite/g++.dg/ext/vector4.C | 6 ++++++ 5 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/ext/complex1.C create mode 100644 gcc/testsuite/g++.dg/ext/vector4.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 91241779462..f50554cab56 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2006-08-22 Andrew Pinski + + PR C++/28450 + * cp/init.c (build_zero_init): Handle VECTOR_TYPE and + COMPLEX_TYPEs. + 2006-08-22 Simon Martin PR c++/28420 diff --git a/gcc/cp/init.c b/gcc/cp/init.c index ff6de3360e5..a88d0c06703 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 502921ce679..0e58baab765 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2006-08-22 Andrew Pinski + + PR C++/28450 + * g++.dg/ext/vector4.C: New test. + * g++.dg/ext/complex1.C: New test. + 2006-08-21 Geoffrey Keating 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 00000000000..ac67711068e --- /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 00000000000..e14578489e6 --- /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))) ();