public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix up tm_clone_hasher
@ 2015-04-22 15:24 Marek Polacek
  2015-04-30  9:40 ` Marek Polacek
  0 siblings, 1 reply; 3+ messages in thread
From: Marek Polacek @ 2015-04-22 15:24 UTC (permalink / raw)
  To: GCC Patches

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  <polacek@redhat.com>

	* 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<tree_map *>
   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<tree_map *> (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<tree_map *> (HTAB_DELETED_ENTRY);
   }
 };
 
-static GTY((cache))
-     hash_table<tm_clone_hasher> *tm_clone_hash;
+static GTY((cache)) hash_table<tm_clone_hasher> *tm_clone_hash;
 
 void
 record_tm_clone_pair (tree o, tree n)

	Marek

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-04-30 16:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-22 15:24 [PATCH] Fix up tm_clone_hasher Marek Polacek
2015-04-30  9:40 ` Marek Polacek
2015-04-30 17:21   ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).