This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] Fix ICE in build_zero_init_1 (PR c++/56403)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 24 Feb 2013 22:41:05 +0100
- Subject: [C++ PATCH] Fix ICE in build_zero_init_1 (PR c++/56403)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
middle-end or back-end created aggregates don't have CLASS_TYPE_P bit set,
so build_zero_init_1 ICEs e.g. on va_list if it is array of structures.
Fixed by treating all RECORD_TYPE or UNION_TYPE types that way, rather than
just CLASS_TYPE_P ones.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2013-02-24 Jakub Jelinek <jakub@redhat.com>
PR c++/56403
* init.c (build_zero_init_1): Use RECORD_OR_UNION_CODE_P instead
of CLASS_TYPE_P.
* g++.dg/torture/pr56403.C: New test.
--- gcc/cp/init.c.jj 2013-02-07 22:27:09.000000000 +0100
+++ gcc/cp/init.c 2013-02-24 20:07:12.246690837 +0100
@@ -179,7 +179,7 @@ build_zero_init_1 (tree type, tree nelts
init = convert (type, nullptr_node);
else if (SCALAR_TYPE_P (type))
init = convert (type, integer_zero_node);
- else if (CLASS_TYPE_P (type))
+ else if (RECORD_OR_UNION_CODE_P (TREE_CODE (type)))
{
tree field;
vec<constructor_elt, va_gc> *v = NULL;
--- gcc/testsuite/g++.dg/torture/pr56403.C.jj 2013-02-24 20:05:41.961233765 +0100
+++ gcc/testsuite/g++.dg/torture/pr56403.C 2013-02-24 20:05:14.000000000 +0100
@@ -0,0 +1,12 @@
+// PR c++/56403
+// { dg-do compile }
+
+#include <stdarg.h>
+
+struct S { va_list err_args; };
+
+void *
+foo ()
+{
+ return new S ();
+}
Jakub