Hi, this patch fixes ICE seen when compiling libreoffice. Sadly I didn't get any testcase since libreoffice one desn't reproduce with -r.
The problem is external vtable whose constructor is not streamed, because we stream only constructors needed and we do not take external vars into account. This patch makes the ICE go away turning 50430 into an missed optimization. We obvoiusly shoud do something for programs with error in them, so the patch makes sense even after we fix the streaming issue. Bootstrapped/regtested x86_64-linux, will commit it shortly. Honza PR lto/50430 * gimple-fold.c (gimple_get_virt_method_for_binfo): Do not ICE on error_mark_node in the DECL_INITIAL of vtable. Index: gimple-fold.c =================================================================== --- gimple-fold.c (revision 178757) +++ gimple-fold.c (working copy) @@ -3048,7 +3048,8 @@ gimple_get_virt_method_for_binfo (HOST_W if (TREE_CODE (v) != VAR_DECL || !DECL_VIRTUAL_P (v) - || !DECL_INITIAL (v)) + || !DECL_INITIAL (v) + || DECL_INITIAL (v) == error_mark_node) return NULL_TREE; gcc_checking_assert (TREE_CODE (TREE_TYPE (v)) == ARRAY_TYPE); size = tree_low_cst (TYPE_SIZE (TREE_TYPE (TREE_TYPE (v))), 1);