PR middle-end/27325
* omp-low.c (lower_omp_sections): Call maybe_catch_exception
on statement list containing also constructors and destructors.
(lower_omp_single, lower_omp_for, lower_omp_parallel): Likewise.
* g++.dg/gomp/pr27325.C: New test.
From-SVN: r113454
2006-05-02 Jakub Jelinek <jakub@redhat.com>
2006-05-02 Jakub Jelinek <jakub@redhat.com>
+ PR middle-end/27325
+ * omp-low.c (lower_omp_sections): Call maybe_catch_exception
+ on statement list containing also constructors and destructors.
+ (lower_omp_single, lower_omp_for, lower_omp_parallel): Likewise.
+
PR middle-end/27310
* except.c (duplicate_eh_regions): Fix clearing of
cfun->eh->region_array entries.
PR middle-end/27310
* except.c (duplicate_eh_regions): Fix clearing of
cfun->eh->region_array entries.
block = make_node (BLOCK);
bind = build3 (BIND_EXPR, void_type_node, NULL, body, block);
block = make_node (BLOCK);
bind = build3 (BIND_EXPR, void_type_node, NULL, body, block);
- maybe_catch_exception (&BIND_EXPR_BODY (bind));
olist = NULL_TREE;
lower_reduction_clauses (OMP_SECTIONS_CLAUSES (stmt), &olist, ctx);
olist = NULL_TREE;
lower_reduction_clauses (OMP_SECTIONS_CLAUSES (stmt), &olist, ctx);
append_to_statement_list (olist, &new_body);
append_to_statement_list (dlist, &new_body);
append_to_statement_list (olist, &new_body);
append_to_statement_list (dlist, &new_body);
+ maybe_catch_exception (&new_body);
+
t = make_node (OMP_RETURN);
OMP_RETURN_NOWAIT (t) = !!find_omp_clause (OMP_SECTIONS_CLAUSES (stmt),
OMP_CLAUSE_NOWAIT);
t = make_node (OMP_RETURN);
OMP_RETURN_NOWAIT (t) = !!find_omp_clause (OMP_SECTIONS_CLAUSES (stmt),
OMP_CLAUSE_NOWAIT);
lower_rec_input_clauses (OMP_SINGLE_CLAUSES (single_stmt),
&BIND_EXPR_BODY (bind), &dlist, ctx);
lower_omp (&OMP_SINGLE_BODY (single_stmt), ctx);
lower_rec_input_clauses (OMP_SINGLE_CLAUSES (single_stmt),
&BIND_EXPR_BODY (bind), &dlist, ctx);
lower_omp (&OMP_SINGLE_BODY (single_stmt), ctx);
- maybe_catch_exception (&OMP_SINGLE_BODY (single_stmt));
append_to_statement_list (single_stmt, &BIND_EXPR_BODY (bind));
append_to_statement_list (single_stmt, &BIND_EXPR_BODY (bind));
append_to_statement_list (dlist, &BIND_EXPR_BODY (bind));
append_to_statement_list (dlist, &BIND_EXPR_BODY (bind));
+ maybe_catch_exception (&BIND_EXPR_BODY (bind));
+
t = make_node (OMP_RETURN);
OMP_RETURN_NOWAIT (t) = !!find_omp_clause (OMP_SINGLE_CLAUSES (single_stmt),
OMP_CLAUSE_NOWAIT);
t = make_node (OMP_RETURN);
OMP_RETURN_NOWAIT (t) = !!find_omp_clause (OMP_SINGLE_CLAUSES (single_stmt),
OMP_CLAUSE_NOWAIT);
append_to_statement_list (stmt, body_p);
append_to_statement_list (stmt, body_p);
- maybe_catch_exception (&OMP_FOR_BODY (stmt));
append_to_statement_list (OMP_FOR_BODY (stmt), body_p);
t = make_node (OMP_CONTINUE);
append_to_statement_list (OMP_FOR_BODY (stmt), body_p);
t = make_node (OMP_CONTINUE);
lower_reduction_clauses (OMP_FOR_CLAUSES (stmt), body_p, ctx);
append_to_statement_list (dlist, body_p);
lower_reduction_clauses (OMP_FOR_CLAUSES (stmt), body_p, ctx);
append_to_statement_list (dlist, body_p);
+ maybe_catch_exception (body_p);
+
/* Region exit marker goes at the end of the loop body. */
t = make_node (OMP_RETURN);
OMP_RETURN_NOWAIT (t) = fd.have_nowait;
/* Region exit marker goes at the end of the loop body. */
t = make_node (OMP_RETURN);
OMP_RETURN_NOWAIT (t) = fd.have_nowait;
par_ilist = NULL_TREE;
lower_rec_input_clauses (clauses, &par_ilist, &par_olist, ctx);
lower_omp (&par_body, ctx);
par_ilist = NULL_TREE;
lower_rec_input_clauses (clauses, &par_ilist, &par_olist, ctx);
lower_omp (&par_body, ctx);
- maybe_catch_exception (&par_body);
lower_reduction_clauses (clauses, &par_olist, ctx);
/* Declare all the variables created by mapping and the variables
lower_reduction_clauses (clauses, &par_olist, ctx);
/* Declare all the variables created by mapping and the variables
append_to_statement_list (par_ilist, &new_body);
append_to_statement_list (par_body, &new_body);
append_to_statement_list (par_olist, &new_body);
append_to_statement_list (par_ilist, &new_body);
append_to_statement_list (par_body, &new_body);
append_to_statement_list (par_olist, &new_body);
+ maybe_catch_exception (&new_body);
t = make_node (OMP_RETURN);
append_to_statement_list (t, &new_body);
OMP_PARALLEL_BODY (stmt) = new_body;
t = make_node (OMP_RETURN);
append_to_statement_list (t, &new_body);
OMP_PARALLEL_BODY (stmt) = new_body;
2006-05-02 Jakub Jelinek <jakub@redhat.com>
2006-05-02 Jakub Jelinek <jakub@redhat.com>
+ PR middle-end/27325
+ * g++.dg/gomp/pr27325.C: New test.
+
PR middle-end/27310
* g++.dg/gomp/pr27310.C: New test.
PR middle-end/27310
* g++.dg/gomp/pr27310.C: New test.
--- /dev/null
+// PR middle-end/27325
+// { dg-do compile }
+// { dg-options "-O2 -fopenmp" }
+
+struct A { A(); ~A(); int i; };
+
+int
+foo ()
+{
+ A a;
+#pragma omp parallel private (a)
+ for (int i = 0; i < 5; ++i)
+ a.i++;
+ return 0;
+}
+
+int
+bar ()
+{
+ A a;
+#pragma omp for private (a)
+ for (int i = 0; i < 5; ++i)
+ a.i++;
+ return 0;
+}