From: Jakub Jelinek Date: Thu, 10 Jul 2008 15:22:50 +0000 (+0200) Subject: re PR middle-end/36790 (ICE on valid code: OpenMP task construct with default(shared... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b826efd98620ba65956843f515fb1698ea6feecf;p=gcc.git re PR middle-end/36790 (ICE on valid code: OpenMP task construct with default(shared) clause) PR middle-end/36790 * omp-low.c (lower_omp_2): If task_shared_vars, test all DECL_P uids in the bitmap, not just VAR_DECL uids. * gcc.dg/gomp/pr36790.c: New test. * g++.dg/gomp/pr36790.C: New test. From-SVN: r137695 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c5b36ecbf6c..96e6b134c66 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2008-07-10 Jakub Jelinek + PR middle-end/36790 + * omp-low.c (lower_omp_2): If task_shared_vars, test all DECL_P + uids in the bitmap, not just VAR_DECL uids. + PR rtl-optimization/36419 * combine-stack-adj.c (adjust_frame_related_expr): New function. (combine_stack_adjustments_for_block): Call it if needed. Delete diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 4378c43d402..2f9aedeac39 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -6246,10 +6246,12 @@ lower_omp_2 (tree *tp, int *walk_subtrees, void *data) omp_context *ctx = (omp_context *) data; /* Any variable with DECL_VALUE_EXPR needs to be regimplified. */ - if (TREE_CODE (t) == VAR_DECL - && ((ctx && DECL_HAS_VALUE_EXPR_P (t)) - || (task_shared_vars - && bitmap_bit_p (task_shared_vars, DECL_UID (t))))) + if (TREE_CODE (t) == VAR_DECL && ctx && DECL_HAS_VALUE_EXPR_P (t)) + return t; + + if (task_shared_vars + && DECL_P (t) + && bitmap_bit_p (task_shared_vars, DECL_UID (t))) return t; /* If a global variable has been privatized, TREE_CONSTANT on diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3c153292307..e4ac8e7026a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2008-07-10 Jakub Jelinek + PR middle-end/36790 + * gcc.dg/gomp/pr36790.c: New test. + * g++.dg/gomp/pr36790.C: New test. + PR rtl-optimization/36419 * g++.dg/eh/async-unwind1.C: New test. diff --git a/gcc/testsuite/g++.dg/gomp/pr36790.C b/gcc/testsuite/g++.dg/gomp/pr36790.C new file mode 100644 index 00000000000..07e8b105252 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr36790.C @@ -0,0 +1,23 @@ +// PR middle-end/36790 +// { dg-do compile } +// { dg-options "-fopenmp -O2" } + +void +foo (bool b) +{ +} + +void +bar (bool b) +{ + foo (b); + #pragma omp task default (shared) + b = false; +} + +int +main () +{ + bar (false); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/gomp/pr36790.c b/gcc/testsuite/gcc.dg/gomp/pr36790.c new file mode 100644 index 00000000000..b3379f1564a --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr36790.c @@ -0,0 +1,23 @@ +/* PR middle-end/36790 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +void +foo (char b) +{ +} + +void +bar (char b) +{ + foo (b); + #pragma omp task default (shared) + b = 0; +} + +int +main () +{ + bar (0); + return 0; +}