From: Paolo Carlini Date: Wed, 6 Nov 2013 20:19:10 +0000 (+0000) Subject: re PR c++/11006 ([CNI] ICE with use of __java_boolean) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=71b71b96f05daefae87b3f5b65b7252987fb6eab;p=gcc.git re PR c++/11006 ([CNI] ICE with use of __java_boolean) /cp 2013-11-06 Paolo Carlini PR c++/11006 * init.c (build_new_1): Don't call build_java_class_ref on non-class types. /testsuite 2013-11-06 Paolo Carlini PR c++/11006 * g++.dg/other/java3.C: New. From-SVN: r204469 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 887ea615944..6369f053217 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2013-11-06 Paolo Carlini + + PR c++/11006 + * init.c (build_new_1): Don't call build_java_class_ref on non-class + types. + 2013-11-05 Jason Merrill PR c++/58868 diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 85732ff3af1..a4d8280dfd8 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -2461,9 +2461,16 @@ build_new_1 (vec **placement, tree type, tree nelts, if (vec_safe_is_empty (*placement) && TYPE_FOR_JAVA (elt_type)) { tree class_addr; - tree class_decl = build_java_class_ref (elt_type); + tree class_decl; static const char alloc_name[] = "_Jv_AllocObject"; + if (!MAYBE_CLASS_TYPE_P (elt_type)) + { + error ("%qT isn%'t a valid Java class type", elt_type); + return error_mark_node; + } + + class_decl = build_java_class_ref (elt_type); if (class_decl == error_mark_node) return error_mark_node; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 463be1e1eee..469b5c9250e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-11-06 Paolo Carlini + + PR c++/11006 + * g++.dg/other/java3.C: New. + 2013-11-06 Uros Bizjak PR target/59021 diff --git a/gcc/testsuite/g++.dg/other/java3.C b/gcc/testsuite/g++.dg/other/java3.C new file mode 100644 index 00000000000..1bc0a8874fe --- /dev/null +++ b/gcc/testsuite/g++.dg/other/java3.C @@ -0,0 +1,7 @@ +// PR c++/11006 + +typedef int* jclass; + +void foo () { + new __java_boolean; // { dg-error "valid" } +}