2011-12-15 Jakub Jelinek <jakub@redhat.com>
PR c/51360
* c-parser.c (c_parser_omp_clause_num_threads,
c_parser_omp_clause_schedule): Call mark_exp_read.
* semantics.c (finish_omp_clauses): For OMP_CLAUSE_NUM_THREADS_EXPR
and OMP_CLAUSE_SCHEDULE_CHUNK_EXPR call mark_rvalue_use.
* gcc.dg/gomp/pr51360.c: New test.
* g++.dg/gomp/pr51360.C: New test.
* g++.dg/gomp/pr51360-2.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@184049
138bc75d-0d04-0410-961f-
82ee72b054a4
Backported from mainline
2011-12-15 Jakub Jelinek <jakub@redhat.com>
+ PR c/51360
+ * c-parser.c (c_parser_omp_clause_num_threads,
+ c_parser_omp_clause_schedule): Call mark_exp_read.
+
PR debug/51517
* tree-ssa-coalesce.c (coalesce_ssa_name): For !optimize, test
!DECL_IGNORED_P instead of !DECL_ARTIFICIAL.
{
location_t expr_loc = c_parser_peek_token (parser)->location;
tree c, t = c_parser_expression (parser).value;
+ mark_exp_read (t);
t = c_fully_fold (t, false, NULL);
c_parser_skip_until_found (parser, CPP_CLOSE_PAREN, "expected %<)%>");
here = c_parser_peek_token (parser)->location;
t = c_parser_expr_no_commas (parser, NULL).value;
+ mark_exp_read (t);
t = c_fully_fold (t, false, NULL);
if (OMP_CLAUSE_SCHEDULE_KIND (c) == OMP_CLAUSE_SCHEDULE_RUNTIME)
+2012-02-09 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2011-12-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/51360
+ * semantics.c (finish_omp_clauses): For OMP_CLAUSE_NUM_THREADS_EXPR
+ and OMP_CLAUSE_SCHEDULE_CHUNK_EXPR call mark_rvalue_use.
+
2012-01-19 Kai Tietz <ktietz@redhat.com>
PR c++/51344
error ("num_threads expression must be integral");
remove = true;
}
+ else
+ OMP_CLAUSE_NUM_THREADS_EXPR (c) = mark_rvalue_use (t);
break;
case OMP_CLAUSE_SCHEDULE:
error ("schedule chunk size expression must be integral");
remove = true;
}
+ else
+ OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (c) = mark_rvalue_use (t);
break;
case OMP_CLAUSE_NOWAIT:
+2012-02-09 Jakub Jelinek <jakub@redhat.com>
+
+ Backported from mainline
+ 2011-12-15 Jakub Jelinek <jakub@redhat.com>
+
+ PR c/51360
+ * gcc.dg/gomp/pr51360.c: New test.
+ * g++.dg/gomp/pr51360.C: New test.
+ * g++.dg/gomp/pr51360-2.C: New test.
+
2012-02-09 Peter Bergner <bergner@vnet.ibm.com>
Backport from mainline
--- /dev/null
+/* PR c/51360 */
+/* { dg-do compile } */
+/* { dg-options "-Wunused -W -fopenmp" } */
+
+void
+foo (int a, int b, int c)
+{
+ int m, n, o, i;
+ m = 6;
+ n = 1;
+ o = 5;
+ a = 6;
+ b = 1;
+ c = 5;
+ #pragma omp parallel for num_threads (m) if (n) schedule (static, o)
+ for (i = 0; i < 10; i++)
+ ;
+ #pragma omp parallel for num_threads (a) if (b) schedule (static, c)
+ for (i = 0; i < 10; i++)
+ ;
+}
--- /dev/null
+// PR c/51360
+// { dg-do compile }
+// { dg-options "-Wunused -W -fopenmp" }
+
+template <typename T>
+void
+foo (T a, T b, T c)
+{
+ T m, n, o, i;
+ m = 6;
+ n = 1;
+ o = 5;
+ a = 6;
+ b = 1;
+ c = 5;
+ #pragma omp parallel for num_threads (m) if (n) schedule (static, o)
+ for (i = 0; i < 10; i++)
+ ;
+ #pragma omp parallel for num_threads (a) if (b) schedule (static, c)
+ for (i = 0; i < 10; i++)
+ ;
+}
+
+void
+bar ()
+{
+ foo (0, 0, 0);
+}
--- /dev/null
+/* PR c/51360 */
+/* { dg-do compile } */
+/* { dg-options "-Wunused -W -fopenmp" } */
+
+void
+foo (int a, int b, int c)
+{
+ int m, n, o, i;
+ m = 6;
+ n = 1;
+ o = 5;
+ a = 6;
+ b = 1;
+ c = 5;
+ #pragma omp parallel for num_threads (m) if (n) schedule (static, o)
+ for (i = 0; i < 10; i++)
+ ;
+ #pragma omp parallel for num_threads (a) if (b) schedule (static, c)
+ for (i = 0; i < 10; i++)
+ ;
+}