aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorIlya Verbin <ilya.verbin@intel.com>2016-04-20 15:48:53 +0000
committerIlya Verbin <iverbin@gcc.gnu.org>2016-04-20 15:48:53 +0000
commit477d4906b8bcb8f248de837f5ddf9e7013f5b01f (patch)
treed16ed1a8023ecf7c6217b7ae8112e22153ff60dd /gcc/c
parentfad08d127f63c0deff683d38034863abf5201bb0 (diff)
downloadgcc-477d4906b8bcb8f248de837f5ddf9e7013f5b01f.zip
gcc-477d4906b8bcb8f248de837f5ddf9e7013f5b01f.tar.gz
gcc-477d4906b8bcb8f248de837f5ddf9e7013f5b01f.tar.bz2
re PR c++/69363 (ICE when doing a pragma simd reduction with max)
Fix PR c++/69363 gcc/c-family/ PR c++/69363 * c-cilkplus.c (c_finish_cilk_clauses): Remove function. * c-common.h (c_finish_cilk_clauses): Remove declaration. gcc/c/ PR c++/69363 * c-parser.c (c_parser_cilk_all_clauses): Use c_finish_omp_clauses instead of c_finish_cilk_clauses. * c-tree.h (c_finish_omp_clauses): Add new default argument. * c-typeck.c (c_finish_omp_clauses): Add new argument. Allow floating-point variables in the linear clause for Cilk Plus. gcc/cp/ PR c++/69363 * cp-tree.h (finish_omp_clauses): Add new default argument. * parser.c (cp_parser_cilk_simd_all_clauses): Use finish_omp_clauses instead of c_finish_cilk_clauses. * semantics.c (finish_omp_clauses): Add new argument. Allow floating-point variables in the linear clause for Cilk Plus. gcc/testsuite/ PR c++/69363 * c-c++-common/cilk-plus/PS/clauses3.c: Adjust dg-error string. * c-c++-common/cilk-plus/PS/clauses4.c: New test. * c-c++-common/cilk-plus/PS/pr69363.c: New test. From-SVN: r235290
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog9
-rw-r--r--gcc/c/c-parser.c2
-rw-r--r--gcc/c/c-tree.h2
-rw-r--r--gcc/c/c-typeck.c34
4 files changed, 37 insertions, 10 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index b46df1f..e300200 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,12 @@
+2016-04-20 Ilya Verbin <ilya.verbin@intel.com>
+
+ PR c++/69363
+ * c-parser.c (c_parser_cilk_all_clauses): Use c_finish_omp_clauses
+ instead of c_finish_cilk_clauses.
+ * c-tree.h (c_finish_omp_clauses): Add new default argument.
+ * c-typeck.c (c_finish_omp_clauses): Add new argument. Allow
+ floating-point variables in the linear clause for Cilk Plus.
+
2016-04-18 Michael Matz <matz@suse.de>
* c-decl.c (merge_decls): Use SET_DECL_ALIGN and SET_TYPE_ALIGN.
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 1b6bacd..bdd669d 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -17509,7 +17509,7 @@ c_parser_cilk_all_clauses (c_parser *parser)
saw_error:
c_parser_skip_to_pragma_eol (parser);
- return c_finish_cilk_clauses (clauses);
+ return c_finish_omp_clauses (clauses, false, false, true);
}
/* This function helps parse the grainsize pragma for a _Cilk_for statement.
diff --git a/gcc/c/c-tree.h b/gcc/c/c-tree.h
index d559207..4633182 100644
--- a/gcc/c/c-tree.h
+++ b/gcc/c/c-tree.h
@@ -661,7 +661,7 @@ extern tree c_begin_omp_task (void);
extern tree c_finish_omp_task (location_t, tree, tree);
extern void c_finish_omp_cancel (location_t, tree);
extern void c_finish_omp_cancellation_point (location_t, tree);
-extern tree c_finish_omp_clauses (tree, bool, bool = false);
+extern tree c_finish_omp_clauses (tree, bool, bool = false, bool = false);
extern tree c_build_va_arg (location_t, tree, location_t, tree);
extern tree c_finish_transaction (location_t, tree, int);
extern bool c_tree_equal (tree, tree);
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index 59a3c61..58c2139 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -12496,7 +12496,8 @@ c_find_omp_placeholder_r (tree *tp, int *, void *data)
Remove any elements from the list that are invalid. */
tree
-c_finish_omp_clauses (tree clauses, bool is_omp, bool declare_simd)
+c_finish_omp_clauses (tree clauses, bool is_omp, bool declare_simd,
+ bool is_cilk)
{
bitmap_head generic_head, firstprivate_head, lastprivate_head;
bitmap_head aligned_head, map_head, map_field_head;
@@ -12778,14 +12779,31 @@ c_finish_omp_clauses (tree clauses, bool is_omp, bool declare_simd)
"clause on %<simd%> or %<for%> constructs");
OMP_CLAUSE_LINEAR_KIND (c) = OMP_CLAUSE_LINEAR_DEFAULT;
}
- if (!INTEGRAL_TYPE_P (TREE_TYPE (t))
- && TREE_CODE (TREE_TYPE (t)) != POINTER_TYPE)
+ if (is_cilk)
{
- error_at (OMP_CLAUSE_LOCATION (c),
- "linear clause applied to non-integral non-pointer "
- "variable with type %qT", TREE_TYPE (t));
- remove = true;
- break;
+ if (!INTEGRAL_TYPE_P (TREE_TYPE (t))
+ && !SCALAR_FLOAT_TYPE_P (TREE_TYPE (t))
+ && TREE_CODE (TREE_TYPE (t)) != POINTER_TYPE)
+ {
+ error_at (OMP_CLAUSE_LOCATION (c),
+ "linear clause applied to non-integral, "
+ "non-floating, non-pointer variable with type %qT",
+ TREE_TYPE (t));
+ remove = true;
+ break;
+ }
+ }
+ else
+ {
+ if (!INTEGRAL_TYPE_P (TREE_TYPE (t))
+ && TREE_CODE (TREE_TYPE (t)) != POINTER_TYPE)
+ {
+ error_at (OMP_CLAUSE_LOCATION (c),
+ "linear clause applied to non-integral non-pointer "
+ "variable with type %qT", TREE_TYPE (t));
+ remove = true;
+ break;
+ }
}
if (declare_simd)
{