aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-03-05 23:12:45 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2018-03-05 23:12:45 +0100
commit46cf7fa13bc81496856b23f9100d76b8bfbbb437 (patch)
tree89c5fdae862264117ae9c0ef3c3de7db44789365 /gcc/cp
parent34b01e681ea99cfeef9dbb69fbb1f9fb1dc3a088 (diff)
downloadgcc-46cf7fa13bc81496856b23f9100d76b8bfbbb437.zip
gcc-46cf7fa13bc81496856b23f9100d76b8bfbbb437.tar.gz
gcc-46cf7fa13bc81496856b23f9100d76b8bfbbb437.tar.bz2
re PR c++/84684 (inserting random code / flags produces wrong code)
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
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/constexpr.c8
2 files changed, 12 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3218814..5e62b1c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 27f841d..941562eb 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -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);
}