re PR c/67500 (OpenMP ICE with invalid safelen/simdlen/alignment expressions)
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. * gcc.dg/gomp/pr67500.c: New test. From-SVN: r227577
This commit is contained in:
parent
f4b189d53b
commit
fce5e5e35f
@ -1,5 +1,12 @@
|
||||
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,
|
||||
|
@ -8912,7 +8912,8 @@ temp_pop_parm_decls (void)
|
||||
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)
|
||||
|
@ -11231,9 +11231,9 @@ c_parser_omp_clause_aligned (c_parser *parser, tree list)
|
||||
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");
|
||||
@ -11310,9 +11310,9 @@ c_parser_omp_clause_safelen (c_parser *parser, tree list)
|
||||
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");
|
||||
@ -11346,9 +11346,9 @@ c_parser_omp_clause_simdlen (c_parser *parser, tree list)
|
||||
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");
|
||||
|
@ -1,5 +1,8 @@
|
||||
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.
|
||||
|
||||
|
42
gcc/testsuite/gcc.dg/gomp/pr67500.c
Normal file
42
gcc/testsuite/gcc.dg/gomp/pr67500.c
Normal file
@ -0,0 +1,42 @@
|
||||
/* 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)
|
||||
;
|
||||
}
|
Loading…
Reference in New Issue
Block a user