re PR c/51360 (spurious unused-but-set-variable warning for var used in OpenMP pragma)
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. * c-c++-common/gomp/pr51360.c: New test. * g++.dg/gomp/pr51360.C: New test. From-SVN: r182381
This commit is contained in:
parent
323492f6f9
commit
7d1362bcd6
|
@ -1,3 +1,9 @@
|
|||
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.
|
||||
|
||||
2011-12-15 Romain Geissler <romain.geissler@gmail.com>
|
||||
|
||||
* builtins.def (BUILT_IN_STPNCPY_CHK): New definition.
|
||||
|
|
|
@ -9011,6 +9011,7 @@ c_parser_omp_clause_num_threads (c_parser *parser, tree list)
|
|||
{
|
||||
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 %<)%>");
|
||||
|
@ -9218,6 +9219,7 @@ c_parser_omp_clause_schedule (c_parser *parser, tree list)
|
|||
|
||||
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)
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
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.
|
||||
|
||||
2011-12-15 Dodji Seketeli <dodji@redhat.com>
|
||||
|
||||
PR c++/51473
|
||||
|
|
|
@ -4087,6 +4087,8 @@ finish_omp_clauses (tree clauses)
|
|||
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:
|
||||
|
@ -4101,6 +4103,8 @@ finish_omp_clauses (tree clauses)
|
|||
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:
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
2011-12-15 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c/51360
|
||||
* c-c++-common/gomp/pr51360.c: New test.
|
||||
* g++.dg/gomp/pr51360.C: New test.
|
||||
|
||||
PR middle-end/49806
|
||||
* gcc.dg/tree-ssa-vrp47.c: Add -fdump-tree-dom2 to dg-options.
|
||||
Check for x_? & y in dom2 dump and xfail the check in dom1 dump.
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/* PR c/51360 */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-Wunused -W -fopenmp" } */
|
||||
|
||||
void
|
||||
foo (int a, int b, int c, int d)
|
||||
{
|
||||
int m, n, o, p, i;
|
||||
m = 6;
|
||||
n = 1;
|
||||
o = 5;
|
||||
p = 1;
|
||||
a = 6;
|
||||
b = 1;
|
||||
c = 5;
|
||||
d = 1;
|
||||
#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++)
|
||||
;
|
||||
#pragma omp task final (p)
|
||||
;
|
||||
#pragma omp task final (d)
|
||||
;
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
// PR c/51360
|
||||
// { dg-do compile }
|
||||
// { dg-options "-Wunused -W -fopenmp" }
|
||||
|
||||
template <typename T>
|
||||
void
|
||||
foo (T a, T b, T c, T d)
|
||||
{
|
||||
T m, n, o, p, i;
|
||||
m = 6;
|
||||
n = 1;
|
||||
o = 5;
|
||||
p = 1;
|
||||
a = 6;
|
||||
b = 1;
|
||||
c = 5;
|
||||
d = 1;
|
||||
#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++)
|
||||
;
|
||||
#pragma omp task final (p)
|
||||
;
|
||||
#pragma omp task final (d)
|
||||
;
|
||||
}
|
||||
|
||||
void
|
||||
bar ()
|
||||
{
|
||||
foo (0, 0, 0, 0);
|
||||
}
|
Loading…
Reference in New Issue