aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-eh.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-10-12 14:21:45 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2019-10-12 14:21:45 +0200
commit853ce7c073eedfba1adfb63530a8bd2baa767137 (patch)
tree31ed1c2b11dab70a360c55ebd718030a25930484 /gcc/tree-eh.c
parent20de9568b49e663be848a35ce0bb08f63f14b5b2 (diff)
downloadgcc-853ce7c073eedfba1adfb63530a8bd2baa767137.zip
gcc-853ce7c073eedfba1adfb63530a8bd2baa767137.tar.gz
gcc-853ce7c073eedfba1adfb63530a8bd2baa767137.tar.bz2
re PR middle-end/92063 (ICE in operation_could_trap_p, at tree-eh.c:2528 when compiling Python's Python/_warnings.c)
PR middle-end/92063 * tree-eh.c (operation_could_trap_helper_p) <case COND_EXPR> <case VEC_COND_EXPR>: Return false with *handled = false. (tree_could_trap_p): For {,VEC_}COND_EXPR return false instead of recursing on the first operand. * fold-const.c (simple_operand_p_2): Use generic_expr_could_trap_p instead of tree_could_trap_p. * tree-ssa-sccvn.c (vn_nary_may_trap): Formatting fixes. * gcc.c-torture/compile/pr92063.c: New test. From-SVN: r276915
Diffstat (limited to 'gcc/tree-eh.c')
-rw-r--r--gcc/tree-eh.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c
index 7a02873..54502e6 100644
--- a/gcc/tree-eh.c
+++ b/gcc/tree-eh.c
@@ -2499,6 +2499,14 @@ operation_could_trap_helper_p (enum tree_code op,
/* Constructing an object cannot trap. */
return false;
+ case COND_EXPR:
+ case VEC_COND_EXPR:
+ /* Whether *COND_EXPR can trap depends on whether the
+ first argument can trap, so signal it as not handled.
+ Whether lhs is floating or not doesn't matter. */
+ *handled = false;
+ return false;
+
default:
/* Any floating arithmetic may trap. */
if (fp_operation && flag_trapping_math)
@@ -2614,9 +2622,12 @@ tree_could_trap_p (tree expr)
if (!expr)
return false;
- /* For COND_EXPR and VEC_COND_EXPR only the condition may trap. */
+ /* In COND_EXPR and VEC_COND_EXPR only the condition may trap, but
+ they won't appear as operands in GIMPLE form, so this is just for the
+ GENERIC uses where it needs to recurse on the operands and so
+ *COND_EXPR itself doesn't trap. */
if (TREE_CODE (expr) == COND_EXPR || TREE_CODE (expr) == VEC_COND_EXPR)
- expr = TREE_OPERAND (expr, 0);
+ return false;
code = TREE_CODE (expr);
t = TREE_TYPE (expr);