From patchwork Tue Apr 26 23:44:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Diego Novillo X-Patchwork-Id: 92973 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 1FE83B6EF0 for ; Wed, 27 Apr 2011 09:44:29 +1000 (EST) Received: (qmail 11202 invoked by alias); 26 Apr 2011 23:44:28 -0000 Received: (qmail 11193 invoked by uid 22791); 26 Apr 2011 23:44:28 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 26 Apr 2011 23:44:14 +0000 Received: from kpbe11.cbf.corp.google.com (kpbe11.cbf.corp.google.com [172.25.105.75]) by smtp-out.google.com with ESMTP id p3QNiDQY019637; Tue, 26 Apr 2011 16:44:13 -0700 Received: from topo.tor.corp.google.com (topo.tor.corp.google.com [172.29.41.2]) by kpbe11.cbf.corp.google.com with ESMTP id p3QNiB9l026369; Tue, 26 Apr 2011 16:44:12 -0700 Received: by topo.tor.corp.google.com (Postfix, from userid 54752) id 654331DA1C2; Tue, 26 Apr 2011 19:44:11 -0400 (EDT) To: reply@codereview.appspotmail.com, crowl@google.com, gcc-patches@gcc.gnu.org Subject: [pph] Fix many segmentation faults when restoring C++ ASTs (issue4441070) Message-Id: <20110426234411.654331DA1C2@topo.tor.corp.google.com> Date: Tue, 26 Apr 2011 19:44:11 -0400 (EDT) From: dnovillo@google.com (Diego Novillo) X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org I have been testing the C++ streamer with a collection of 6,576 C test cases taken from the GCC testsuite. These C programs build fine with g++, so I encapsulated them inside a single header file and created a .cc file that simply #includes it. The intent is to make sure we can PPH generate and read a single header file. Before this patch, we were failing to build about 1,800 test cases. Most of those failures were due to the streamer reading an LTO tag for a language-specific code and confusing it with a decl reference. This was happening because LTO tag codes were overlapping with language specific tree codes. With this patch the number of failures goes from 1,800 to 146. I will be adding a .exp file to the testsuite in a future patch. Right now, I'm testing this from a shell script. Tested on x86_64. Committed to the branch. Diego. ChangeLog.pph 2011-04-26 Diego Novillo * lto-streamer.h (enum LTO_tags): Change LTO_bb0 to begin after MAX_TREE_CODES. --- This patch is available for review at http://codereview.appspot.com/4441070 diff --git a/gcc/lto-streamer.h b/gcc/lto-streamer.h index 8d5b1d2..b6f4b79 100644 --- a/gcc/lto-streamer.h +++ b/gcc/lto-streamer.h @@ -268,7 +268,7 @@ enum LTO_tags Conversely, to map between LTO tags and tree/gimple codes, the reverse operation must be applied. */ - LTO_bb0 = 1 + NUM_TREE_CODES + LAST_AND_UNUSED_GIMPLE_CODE, + LTO_bb0 = 1 + MAX_TREE_CODES + LAST_AND_UNUSED_GIMPLE_CODE, LTO_bb1, /* EH region holding the previous statement. */