From patchwork Sun Dec 16 16:33:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John David Anglin X-Patchwork-Id: 206681 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 003BA2C009B for ; Mon, 17 Dec 2012 03:33:55 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1356280438; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Subject:Message-ID:Reply-To:MIME-Version:Content-Type: Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=UbgnJH/6i3aYIhmJNBSg7dsiCB4=; b=w0l1rf10NBFgm4g wipNXCz5Laps54WPp6TteoiGWjaVha4JtV3dDpTLhkoRUvxTP3Lv2jOOET4yM9fQ d3suQf9sZ3BUInGw3MtDNumrhrai06aRtSqeoAQcpT+YZYhc0LWS+hHHIA5Q8V7Y kklxqRLj9trAR1sPFVya27alahHA= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Date:From:To:Subject:Message-ID:Reply-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=bQRYsnlZawB1X7i2ehojK5Uom/NIaw5Fo+i6rLn+SupWIpnEFC0jNMUKLOyrgo zBdxQyFxMS4H0BxpH4qNZ+DyuDcgqLXgwBOboFsWUU8KrU1qHxYGpXLr9JuZnNJF Qn1NiCO/lDdYz+rdABeiGP8qj/QMl9hg/gGSDSfxNFdYI=; Received: (qmail 2940 invoked by alias); 16 Dec 2012 16:33:44 -0000 Received: (qmail 2928 invoked by uid 22791); 16 Dec 2012 16:33:41 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from hiauly1.hia.nrc.ca (HELO hiauly1.hia.nrc.ca) (132.246.10.84) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 16 Dec 2012 16:33:27 +0000 Received: by hiauly1.hia.nrc.ca (Postfix, from userid 1000) id CEE374DD9; Sun, 16 Dec 2012 11:33:23 -0500 (EST) Date: Sun, 16 Dec 2012 11:33:22 -0500 From: John David Anglin To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix Infinite loop in pointer_set_insert Message-ID: <20121216163322.GA23093@hiauly1.hia.nrc.ca> Reply-To: John David Anglin MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.16 (2007-06-09) 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 The attached patch fixes a regression introduced on the trunk to fix PR middle-end/52640. The fix was previously applied to the 4.6 and 4.7 branches. Tested on hppa-unknown-linux-gnu with full bootstrap. OK for trunk? Dave Index: varasm.c =================================================================== --- varasm.c (revision 194441) +++ varasm.c (working copy) @@ -2088,6 +2088,11 @@ it all the way to final. See PR 17982 for further discussion. */ static GTY(()) tree pending_assemble_externals; +/* Some targets delay some output to final using TARGET_ASM_FILE_END. + As a result, assemble_external can be called after the list of externals + is processed and the pointer set destroyed. */ +static bool pending_assemble_externals_processed; + #ifdef ASM_OUTPUT_EXTERNAL /* Avoid O(external_decls**2) lookups in the pending_assemble_externals TREE_LIST in assemble_external. */ @@ -2144,6 +2149,7 @@ assemble_external_real (TREE_VALUE (list)); pending_assemble_externals = 0; + pending_assemble_externals_processed = true; pointer_set_destroy (pending_assemble_externals_set); #endif } @@ -2196,6 +2202,12 @@ weak_decls = tree_cons (NULL, decl, weak_decls); #ifdef ASM_OUTPUT_EXTERNAL + if (pending_assemble_externals_processed) + { + assemble_external_real (decl); + return; + } + if (! pointer_set_insert (pending_assemble_externals_set, decl)) pending_assemble_externals = tree_cons (NULL, decl, pending_assemble_externals);