#include "gimple-pretty-print.h"
#include "stringpool.h"
#include "attribs.h"
+#include "tree-eh.h"
/* OMP region information. Every parallel and workshare
directive is enclosed between two markers, the OMP_* directive
flag_rounding_math = save_flag_rounding_math;
t = force_gimple_operand_gsi (gsi, t, true, NULL_TREE, false,
GSI_CONTINUE_LINKING);
- cond_stmt
- = gimple_build_cond (LT_EXPR, t,
- build_zero_cst (double_type_node),
- NULL_TREE, NULL_TREE);
+ if (flag_exceptions
+ && cfun->can_throw_non_call_exceptions
+ && operation_could_trap_p (LT_EXPR, true, false, NULL_TREE))
+ {
+ tree tem = fold_build2 (LT_EXPR, boolean_type_node, t,
+ build_zero_cst (double_type_node));
+ tem = force_gimple_operand_gsi (gsi, tem, true, NULL_TREE,
+ false, GSI_CONTINUE_LINKING);
+ cond_stmt = gimple_build_cond (NE_EXPR, tem,
+ boolean_false_node,
+ NULL_TREE, NULL_TREE);
+ }
+ else
+ cond_stmt
+ = gimple_build_cond (LT_EXPR, t,
+ build_zero_cst (double_type_node),
+ NULL_TREE, NULL_TREE);
gsi_insert_after (gsi, cond_stmt, GSI_CONTINUE_LINKING);
e = split_block (gsi_bb (*gsi), cond_stmt);
basic_block bb1 = e->src;
--- /dev/null
+/* PR tree-optimization/96424 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -O0 -fexceptions -fnon-call-exceptions -fprofile-use -Wno-missing-profile" } */
+
+void
+foo (void)
+{
+ int i, j;
+#pragma omp for collapse (2)
+ for (i = 0; i < 10; ++i)
+ for (j = 0; j <= i; ++j)
+ ;
+}
+
+void
+bar (void)
+{
+ int i, j;
+#pragma omp for collapse (2)
+ for (i = 0; i < 10; ++i)
+ for (j = 0; j < i; ++j)
+ ;
+}