[Bug c++/70267] ICE on valid code at -O1 and above on x86_64-linux-gnu in propagate_necessity, at tree-ssa-dce.c:924
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Mar 17 16:24:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70267
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Perhaps
--- gcc/cp/init.c.jj 2016-03-05 07:46:50.000000000 +0100
+++ gcc/cp/init.c 2016-03-17 17:18:21.326917746 +0100
@@ -2872,6 +2872,14 @@ build_new_1 (vec<tree, va_gc> **placemen
return error_mark_node;
}
alloc_fn = OVL_CURRENT (alloc_fn);
+ if (TREE_CODE (alloc_fn) != FUNCTION_DECL
+ || TREE_CODE (TREE_TYPE (alloc_fn)) != FUNCTION_TYPE
+ || !POINTER_TYPE_P (TREE_TYPE (TREE_TYPE (alloc_fn))))
+ {
+ if (complain & tf_error)
+ error ("%qD is not a function returning a pointer", alloc_fn);
+ return error_mark_node;
+ }
class_addr = build1 (ADDR_EXPR, jclass_node, class_decl);
alloc_call = cp_build_function_call_nary (alloc_fn, complain,
class_addr, NULL_TREE);
?
Though, there are many other calls to get_global_value_if_present in the C++
FE, which probably also need some sanity checking, whether declaring those
functions with weirdo return or argument types can't cause ICEs.
More information about the Gcc-bugs
mailing list