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 <pola...@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