re PR c++/84684 (inserting random code / flags produces wrong code)
authorJakub Jelinek <jakub@redhat.com>
Mon, 5 Mar 2018 22:12:45 +0000 (23:12 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 5 Mar 2018 22:12:45 +0000 (23:12 +0100)
PR c++/84684
* constexpr.c (constexpr_call_hasher::equal): Return false if
lhs->hash != rhs->hash.  Change return 1 to return true and
return 0 to return false.

From-SVN: r258262

gcc/cp/ChangeLog
gcc/cp/constexpr.c

index 3218814124eafecb8cad987a24a142651f0580f1..5e62b1ce06dce0586eb1d985e5870a2e9f6a863c 100644 (file)
@@ -1,3 +1,10 @@
+2018-03-05  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/84684
+       * constexpr.c (constexpr_call_hasher::equal): Return false if
+       lhs->hash != rhs->hash.  Change return 1 to return true and
+       return 0 to return false.
+
 2018-03-05  Nathan Sidwell  <nathan@acm.org>
 
        PR c++/84702
index 27f841db38f09e985803020652a664257907cfeb..941562ebb054c1715acb80e046011fd9e64f76bd 100644 (file)
@@ -1033,9 +1033,11 @@ constexpr_call_hasher::equal (constexpr_call *lhs, constexpr_call *rhs)
   tree lhs_bindings;
   tree rhs_bindings;
   if (lhs == rhs)
-    return 1;
+    return true;
+  if (lhs->hash != rhs->hash)
+    return false;
   if (!constexpr_fundef_hasher::equal (lhs->fundef, rhs->fundef))
-    return 0;
+    return false;
   lhs_bindings = lhs->bindings;
   rhs_bindings = rhs->bindings;
   while (lhs_bindings != NULL && rhs_bindings != NULL)
@@ -1044,7 +1046,7 @@ constexpr_call_hasher::equal (constexpr_call *lhs, constexpr_call *rhs)
       tree rhs_arg = TREE_VALUE (rhs_bindings);
       gcc_assert (TREE_TYPE (lhs_arg) == TREE_TYPE (rhs_arg));
       if (!cp_tree_equal (lhs_arg, rhs_arg))
-        return 0;
+        return false;
       lhs_bindings = TREE_CHAIN (lhs_bindings);
       rhs_bindings = TREE_CHAIN (rhs_bindings);
     }