From: Jakub Jelinek Date: Fri, 23 May 2008 13:21:47 +0000 (+0200) Subject: re PR c++/36237 (internal compiler error: in lower_stmt, at gimple-low.c:282 erase... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c2898ec95001c8fa2818dff36e839787c8cf72d8;p=gcc.git re PR c++/36237 (internal compiler error: in lower_stmt, at gimple-low.c:282 erase 'private(localTodoStack)' it compiles successfully.) PR c++/36237 * cp-gimplify.c (cxx_omp_clause_apply_fn): Call fold_build_cleanup_point_expr on build_call_a results. * g++.dg/gomp/pr36237.C: New test. From-SVN: r135802 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9de41887aa3..b4cf3d40460 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2008-05-23 Jakub Jelinek + PR c++/36237 + * cp-gimplify.c (cxx_omp_clause_apply_fn): Call + fold_build_cleanup_point_expr on build_call_a results. + PR c++/36308 * semantics.c (omp_clause_info_fndecl): New function. (finish_omp_clauses): Use it. diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index 498ecc5379a..cc3e8479921 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -1,6 +1,6 @@ /* C++-specific tree lowering bits; see also c-gimplify.c and tree-gimple.c. - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. Contributed by Jason Merrill @@ -784,7 +784,7 @@ cp_genericize (tree fndecl) static tree cxx_omp_clause_apply_fn (tree fn, tree arg1, tree arg2) { - tree defparm, parm; + tree defparm, parm, t; int i = 0; int nargs; tree *argarray; @@ -804,7 +804,7 @@ cxx_omp_clause_apply_fn (tree fn, tree arg1, tree arg2) tree inner_type = TREE_TYPE (arg1); tree start1, end1, p1; tree start2 = NULL, p2 = NULL; - tree ret = NULL, lab, t; + tree ret = NULL, lab; start1 = arg1; start2 = arg2; @@ -849,6 +849,8 @@ cxx_omp_clause_apply_fn (tree fn, tree arg1, tree arg2) argarray[i] = convert_default_arg (TREE_VALUE (parm), TREE_PURPOSE (parm), fn, i); t = build_call_a (fn, i, argarray); + t = fold_convert (void_type_node, t); + t = fold_build_cleanup_point_expr (TREE_TYPE (t), t); append_to_statement_list (t, &ret); t = TYPE_SIZE_UNIT (inner_type); @@ -881,7 +883,9 @@ cxx_omp_clause_apply_fn (tree fn, tree arg1, tree arg2) argarray[i] = convert_default_arg (TREE_VALUE (parm), TREE_PURPOSE (parm), fn, i); - return build_call_a (fn, i, argarray); + t = build_call_a (fn, i, argarray); + t = fold_convert (void_type_node, t); + return fold_build_cleanup_point_expr (TREE_TYPE (t), t); } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 420a482832f..9397bb51472 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-05-23 Jakub Jelinek + + PR c++/36237 + * g++.dg/gomp/pr36237.C: New test. + 2008-05-23 Kaveh R. Ghazi * gcc.dg/builtins-error.c: Test __builtin_fpclassify. Also diff --git a/gcc/testsuite/g++.dg/gomp/pr36237.C b/gcc/testsuite/g++.dg/gomp/pr36237.C new file mode 100644 index 00000000000..29c7adc8a27 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr36237.C @@ -0,0 +1,25 @@ +// PR c++/36237 +// { dg-do compile } +// { dg-options "-fopenmp" } + +struct A +{ + ~A (); +}; + +struct B +{ + B (const A &x = A ()) : a (x) { } + A a; +}; + +B var; + +void bar (); + +void +foo () +{ + #pragma omp parallel private (var) + bar (); +} diff --git a/libgomp/testsuite/libgomp.c++/ctor-12.C b/libgomp/testsuite/libgomp.c++/ctor-12.C index 762cbd96275..8bd53de3f23 100644 --- a/libgomp/testsuite/libgomp.c++/ctor-12.C +++ b/libgomp/testsuite/libgomp.c++/ctor-12.C @@ -3,7 +3,7 @@ extern "C" void abort (); -static int ctors, dtors, copyctors, n, m; +static int n; struct A {