2015-09-09 Jakub Jelinek <jakub@redhat.com>
+ PR c/67500
+ * c-parser.c (c_parser_omp_clause_aligned,
+ c_parser_omp_clause_safelen, c_parser_omp_clause_simdlen): Fix up
+ test for errors.
+ * c-decl.c (temp_pop_parm_decls): Allow b->decl equal to
+ error_mark_node.
+
PR c/67495
* c-parser.c (c_parser_omp_atomic): Use c_parser_cast_expression
instead of c_parser_unary_expression. If the result is !lvalue_p,
current_scope->bindings = NULL;
for (; b; b = free_binding_and_advance (b))
{
- gcc_assert (TREE_CODE (b->decl) == PARM_DECL);
+ gcc_assert (TREE_CODE (b->decl) == PARM_DECL
+ || b->decl == error_mark_node);
gcc_assert (I_SYMBOL_BINDING (b->id) == b);
I_SYMBOL_BINDING (b->id) = b->shadowed;
if (b->shadowed && b->shadowed->u.type)
tree alignment = c_parser_expr_no_commas (parser, NULL).value;
mark_exp_read (alignment);
alignment = c_fully_fold (alignment, false, NULL);
- if (!INTEGRAL_TYPE_P (TREE_TYPE (alignment))
- && TREE_CODE (alignment) != INTEGER_CST
- && tree_int_cst_sgn (alignment) != 1)
+ if (TREE_CODE (alignment) != INTEGER_CST
+ || !INTEGRAL_TYPE_P (TREE_TYPE (alignment))
+ || tree_int_cst_sgn (alignment) != 1)
{
error_at (clause_loc, "%<aligned%> clause alignment expression must "
"be positive constant integer expression");
t = c_parser_expr_no_commas (parser, NULL).value;
mark_exp_read (t);
t = c_fully_fold (t, false, NULL);
- if (!INTEGRAL_TYPE_P (TREE_TYPE (t))
- && TREE_CODE (t) != INTEGER_CST
- && tree_int_cst_sgn (t) != 1)
+ if (TREE_CODE (t) != INTEGER_CST
+ || !INTEGRAL_TYPE_P (TREE_TYPE (t))
+ || tree_int_cst_sgn (t) != 1)
{
error_at (clause_loc, "%<safelen%> clause expression must "
"be positive constant integer expression");
t = c_parser_expr_no_commas (parser, NULL).value;
mark_exp_read (t);
t = c_fully_fold (t, false, NULL);
- if (!INTEGRAL_TYPE_P (TREE_TYPE (t))
- && TREE_CODE (t) != INTEGER_CST
- && tree_int_cst_sgn (t) != 1)
+ if (TREE_CODE (t) != INTEGER_CST
+ || !INTEGRAL_TYPE_P (TREE_TYPE (t))
+ || tree_int_cst_sgn (t) != 1)
{
error_at (clause_loc, "%<simdlen%> clause expression must "
"be positive constant integer expression");
2015-09-09 Jakub Jelinek <jakub@redhat.com>
+ PR c/67500
+ * gcc.dg/gomp/pr67500.c: New test.
+
PR c/67495
* gcc.dg/gomp/pr67495.c: New test.
--- /dev/null
+/* PR c/67500 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+#pragma omp declare simd simdlen(d) /* { dg-error "clause expression must be positive constant integer expression" } */
+void f1 (int); /* { dg-error "undeclared here" "" { target *-*-* } 5 } */
+#pragma omp declare simd simdlen(0.5) /* { dg-error "clause expression must be positive constant integer expression" } */
+void f2 (int);
+#pragma omp declare simd simdlen(-2) /* { dg-error "clause expression must be positive constant integer expression" } */
+void f3 (int);
+#pragma omp declare simd simdlen(0) /* { dg-error "clause expression must be positive constant integer expression" } */
+void f4 (int);
+
+void
+foo (int *p)
+{
+ int i;
+ #pragma omp simd safelen(d) /* { dg-error "must be positive constant integer expression" } */
+ for (i = 0; i < 16; ++i) /* { dg-error "undeclared" "" { target *-*-* } 18 } */
+ ;
+ #pragma omp simd safelen(0.5) /* { dg-error "must be positive constant integer expression" } */
+ for (i = 0; i < 16; ++i)
+ ;
+ #pragma omp simd safelen(-2) /* { dg-error "must be positive constant integer expression" } */
+ for (i = 0; i < 16; ++i)
+ ;
+ #pragma omp simd safelen(0) /* { dg-error "must be positive constant integer expression" } */
+ for (i = 0; i < 16; ++i)
+ ;
+ #pragma omp simd aligned(p:d) /* { dg-error "must be positive constant integer expression" } */
+ for (i = 0; i < 16; ++i)
+ ;
+ #pragma omp simd aligned(p:0.5) /* { dg-error "must be positive constant integer expression" } */
+ for (i = 0; i < 16; ++i)
+ ;
+ #pragma omp simd aligned(p:-2) /* { dg-error "must be positive constant integer expression" } */
+ for (i = 0; i < 16; ++i)
+ ;
+ #pragma omp simd aligned(p:0) /* { dg-error "must be positive constant integer expression" } */
+ for (i = 0; i < 16; ++i)
+ ;
+}