summaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2019-03-25 10:05:15 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2019-03-25 10:05:15 +0000
commitf22e586c69e634fe6a48c4062ebde0db4d94cd1c (patch)
treeae7b52ed845f79786fc8b9256c836ad4dc1b9876 /gcc/fold-const.c
parent4c6d441da15fe18b504d63f19e59b7cd49b6371a (diff)
re PR middle-end/89790 (ICE segfault in operand_equal_p() at fold-const.c:3000 with -Wduplicated-cond since r269838)
2019-03-25 Richard Biener <rguenther@suse.de> PR middle-end/89790 * fold-const.c (operand_equal_p): Revert last change with updated comment. * g++.dg/pr89790.C: New testcase. From-SVN: r269907
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 86ad2cb8487..c2884a67519 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -2973,6 +2973,11 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags)
|| TREE_TYPE (arg1) == error_mark_node)
return 0;
+ /* Similar, if either does not have a type (like a template id),
+ they aren't equal. */
+ if (!TREE_TYPE (arg0) || !TREE_TYPE (arg1))
+ return 0;
+
/* We cannot consider pointers to different address space equal. */
if (POINTER_TYPE_P (TREE_TYPE (arg0))
&& POINTER_TYPE_P (TREE_TYPE (arg1))