From 9058a2c5c5505f75e40f96f0a86d4e343d7c2743 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Mon, 10 Apr 2017 13:19:42 -0600 Subject: [PATCH] re PR tree-optimization/80374 (ICE in fold_convert_loc, at fold-const.c:2384) PR tree-optimization/80374 * tree-ssa-dom.c (derive_equivalences_from_bit_ior): Do not try to record anything if we can not convert integer_zero_node to the desired type. PR tree-optimization/80374 * g++.dg/pr80374.c: New test. From-SVN: r246819 --- gcc/ChangeLog | 7 +++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/pr80374.C | 19 +++++++++++++++++++ gcc/tree-ssa-dom.c | 3 ++- 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/pr80374.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1a22bc037d4..9f46d13b032 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-04-10 Jeff Law + + PR tree-optimization/80374 + * tree-ssa-dom.c (derive_equivalences_from_bit_ior): Do not try to + record anything if we can not convert integer_zero_node to the + desired type. + 2017-04-10 Kelvin Nilsen PR target/80108 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index de2de1c8f2c..4787f0af7c4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-04-10 Jeff Law + + PR tree-optimization/80374 + * g++.dg/pr80374.c: New test. + 2017-04-10 Kelvin Nilsen PR target/80108 diff --git a/gcc/testsuite/g++.dg/pr80374.C b/gcc/testsuite/g++.dg/pr80374.C new file mode 100644 index 00000000000..b02b65629ae --- /dev/null +++ b/gcc/testsuite/g++.dg/pr80374.C @@ -0,0 +1,19 @@ +void a (const char *, const char *, int, const char *) + __attribute__ ((__noreturn__)); +template +void +c () try + { + throw; + } +catch (b d) + { + if (d) + a ("", "", 2, __PRETTY_FUNCTION__); + } +main () +{ + using e = decltype (nullptr); + c (); +} + diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c index d2263bb13e6..d9e5942206b 100644 --- a/gcc/tree-ssa-dom.c +++ b/gcc/tree-ssa-dom.c @@ -701,7 +701,8 @@ derive_equivalences_from_bit_ior (tree name, const_and_copies *const_and_copies, int recursion_limit) { - if (recursion_limit == 0) + if (recursion_limit == 0 + || !fold_convertible_p (TREE_TYPE (name), integer_zero_node)) return; if (TREE_CODE (name) == SSA_NAME) -- 2.30.2