From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 116628 invoked by alias); 22 Apr 2015 15:24:53 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 116608 invoked by uid 89); 22 Apr 2015 15:24:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 22 Apr 2015 15:24:49 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id E841BC6A24 for ; Wed, 22 Apr 2015 15:24:47 +0000 (UTC) Received: from redhat.com (ovpn-204-27.brq.redhat.com [10.40.204.27]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3MFOilm032701 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Wed, 22 Apr 2015 11:24:47 -0400 Date: Wed, 22 Apr 2015 15:24:00 -0000 From: Marek Polacek To: GCC Patches Subject: [PATCH] Fix up tm_clone_hasher Message-ID: <20150422152443.GH28950@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2015-04/txt/msg01324.txt.bz2 handle_cache_entry in tm_clone_hasher looks wrong: the condition if (e != HTAB_EMPTY_ENTRY || e != HTAB_DELETED_ENTRY) is always true. While it could be fixed by just changing || into &&, I decided to follow suit and do what we do in handle_cache_entry's elsewhere in the codebase. I've fixed a formatting issue below while at it. Bootstrapped/regtested on x86_64-linux, ok for trunk? I think this should also go into 5.1. 2015-04-22 Marek Polacek * varasm.c (handle_cache_entry): Fix logic. diff --git gcc/varasm.c gcc/varasm.c index 1597de1..3fc0316 100644 --- gcc/varasm.c +++ gcc/varasm.c @@ -5779,21 +5779,20 @@ struct tm_clone_hasher : ggc_cache_hasher static hashval_t hash (tree_map *m) { return tree_map_hash (m); } static bool equal (tree_map *a, tree_map *b) { return tree_map_eq (a, b); } - static void handle_cache_entry (tree_map *&e) + static void + handle_cache_entry (tree_map *&e) { - if (e != HTAB_EMPTY_ENTRY || e != HTAB_DELETED_ENTRY) - { - extern void gt_ggc_mx (tree_map *&); - if (ggc_marked_p (e->base.from)) - gt_ggc_mx (e); - else - e = static_cast (HTAB_DELETED_ENTRY); - } + extern void gt_ggc_mx (tree_map *&); + if (e == HTAB_EMPTY_ENTRY || e == HTAB_DELETED_ENTRY) + return; + else if (ggc_marked_p (e->base.from)) + gt_ggc_mx (e); + else + e = static_cast (HTAB_DELETED_ENTRY); } }; -static GTY((cache)) - hash_table *tm_clone_hash; +static GTY((cache)) hash_table *tm_clone_hash; void record_tm_clone_pair (tree o, tree n) Marek