From: Andrew Pinski Date: Wed, 11 Oct 2006 03:10:25 +0000 (+0000) Subject: re PR c++/28450 (ICE with new and complex/vector types) X-Git-Tag: releases/gcc-4.0.4~295 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74e9c8e969830c196dec9b8423093408f66000d6;p=thirdparty%2Fgcc.git re PR c++/28450 (ICE with new and complex/vector types) 2006-10-10 Andrew Pinski PR C++/28450 * cp/init.c (build_zero_init): Handle VECTOR_TYPE and COMPLEX_TYPEs. 2006-10-10 Andrew Pinski PR C++/28450 * g++.dg/ext/vector4.C: New test. * g++.dg/ext/complex1.C: New test. From-SVN: r117627 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 8288aa3b1607..2323905c5340 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2006-10-10 Andrew Pinski + + PR C++/28450 + * cp/init.c (build_zero_init): Handle VECTOR_TYPE and + COMPLEX_TYPEs. + 2006-10-09 Andrew Pinski PR C++/28349 diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 5f22741e48f4..95026fd51a6b 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3fa5a85d7778..fa28b43ae315 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2006-10-10 Andrew Pinski + + PR C++/28450 + * g++.dg/ext/vector4.C: New test. + * g++.dg/ext/complex1.C: New test. + 2006-10-09 Andrew Pinski 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 index 000000000000..ac67711068e6 --- /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 000000000000..e14578489e6c --- /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))) ();