From patchwork Fri Sep 16 14:36:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: partial fix for PR lto/50430 Date: Fri, 16 Sep 2011 04:36:17 -0000 From: Jan Hubicka X-Patchwork-Id: 114935 Message-Id: <20110916143617.GD13520@kam.mff.cuni.cz> To: gcc-patches@gcc.gnu.org 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);