From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16062 invoked by alias); 11 Oct 2012 15:16:32 -0000 Received: (qmail 15840 invoked by uid 48); 11 Oct 2012 15:16:08 -0000 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/54898] [4.8 regression] ICE in uniquify_nodes, at lto/lto.c:1898 Date: Thu, 11 Oct 2012 15:16:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: lto X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.0 X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-10/txt/msg01092.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54898 --- Comment #4 from Richard Biener 2012-10-11 15:16:07 UTC --- We produce this situation somewhen during WPA stage (probably type merging). (gdb) p expr $1 = (tree) 0x7ffff693e3f0 (gdb) p expr->type_common.main_variant $2 = (tree) 0x7ffff6922b28 type merging assumes that if TYPE_MAIN_VARIANT (t) == t then t will prevail or be replaced with a different type that also is a main variant. we first read $2, with main variant 0x7ffff67f05e8: (gdb) call debug_tree ($2) constant 32> unit size constant 4> align 32 symtab 0 alias set -1 structural equality precision 32 min max context > (gdb) call debug_tree ($10) constant 32> unit size constant 4> align 32 symtab 0 alias set -1 canonical type 0x7ffff67f05e8 precision 32 min max pointer_to_this > then we read $1 (gdb) call debug_tree ($1) constant 32> unit size constant 4> align 32 symtab 0 alias set -1 structural equality precision 32 min max > (gdb) call debug_tree ($1->type_common.main_variant) constant 32> unit size constant 4> align 32 symtab 0 alias set -1 canonical type 0x7ffff67f05e8 precision 32 min max context pointer_to_this > ouch. With the following asserts the testcase can possibly be reduced: Index: gcc/tree-streamer-in.c =================================================================== --- gcc/tree-streamer-in.c (revision 192359) +++ gcc/tree-streamer-in.c (working copy) @@ -703,6 +703,7 @@ lto_input_ts_type_common_tree_pointers ( /* Do not stream TYPE_NEXT_VARIANT, we reconstruct the variant lists during fixup. */ TYPE_MAIN_VARIANT (expr) = stream_read_tree (ib, data_in); + gcc_assert (TYPE_MAIN_VARIANT (expr) == TYPE_MAIN_VARIANT (TYPE_MAIN_VARIANT (expr)) || TYPE_MAIN_VARIANT (TYPE_MAIN_VARIANT (expr)) == NULL_TREE); TYPE_CONTEXT (expr) = stream_read_tree (ib, data_in); /* TYPE_CANONICAL gets re-computed during type merging. */ TYPE_CANONICAL (expr) = NULL_TREE; Index: gcc/tree-streamer-out.c =================================================================== --- gcc/tree-streamer-out.c (revision 192359) +++ gcc/tree-streamer-out.c (working copy) @@ -612,6 +612,7 @@ write_ts_type_common_tree_pointers (stru reconstructed during fixup. */ /* Do not stream TYPE_NEXT_VARIANT, we reconstruct the variant lists during fixup. */ + gcc_assert (TYPE_MAIN_VARIANT (expr) == TYPE_MAIN_VARIANT (TYPE_MAIN_VARIANT (expr))); stream_write_tree (ob, TYPE_MAIN_VARIANT (expr), ref_p); stream_write_tree (ob, TYPE_CONTEXT (expr), ref_p); /* TYPE_CANONICAL is re-computed during type merging, so no need