Commit 41521dee by Jakub Jelinek Committed by Jakub Jelinek

c-parser.c (c_parser_omp_declare_simd): Reject declare simd in pragma_stmt context.

	* c-parser.c (c_parser_omp_declare_simd): Reject declare simd in
	pragma_stmt context.

	* gcc.dg/gomp/declare-simd-1.c (f9): Remove.
	* gcc.dg/gomp/declare-simd-5.c: New test.

From-SVN: r255116
parent 3b575376
2017-11-23 Jakub Jelinek <jakub@redhat.com>
* c-parser.c (c_parser_omp_declare_simd): Reject declare simd in
pragma_stmt context.
2017-11-23 Mike Stump <mikestump@comcast.net>
Eric Botcazou <ebotcazou@adacore.com>
......
......@@ -17486,11 +17486,11 @@ c_parser_omp_declare_simd (c_parser *parser, enum pragma_context context)
break;
case pragma_struct:
case pragma_param:
case pragma_stmt:
c_parser_error (parser, "%<#pragma omp declare simd%> must be followed by "
"function declaration or definition");
break;
case pragma_compound:
case pragma_stmt:
if (c_parser_next_token_is (parser, CPP_KEYWORD)
&& c_parser_peek_token (parser)->keyword == RID_EXTENSION)
{
......
2017-11-23 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/gomp/declare-simd-1.c (f9): Remove.
* gcc.dg/gomp/declare-simd-5.c: New test.
* g++.dg/pr65240-1.C: Add -Wno-return-type to dg-options.
* g++.dg/pr65240-2.C: Likewise.
* g++.dg/pr65240-3.C: Likewise.
......
......@@ -58,18 +58,6 @@ f7 (int x)
/* { dg-final { scan-assembler-times "_ZGVeM16v_f7:" 1 { target { i?86-*-* x86_64-*-* } } } } */
/* { dg-final { scan-assembler-times "_ZGVeN16v_f7:" 1 { target { i?86-*-* x86_64-*-* } } } } */
int
f9 (int x)
{
if (x)
#pragma omp declare simd simdlen (8) aligned (b : 8 * sizeof (int))
extern int f10 (int a, int *b, int c);
while (x < 10)
#pragma omp declare simd simdlen (8) aligned (b : 8 * sizeof (int))
extern int f11 (int a, int *b, int c);
return x;
}
#pragma omp declare simd uniform (a) aligned (b : 8 * sizeof (int)) linear (c : 4) simdlen (8)
int f12 (int c; int *b; int a; int a, int *b, int c);
......
/* Test parsing of #pragma omp declare simd */
/* { dg-do compile } */
int
f1 (int x)
{
if (x)
#pragma omp declare simd simdlen (8) aligned (b : 8 * sizeof (int))
extern int f3 (int a, int *b, int c); /* { dg-error "must be followed by function declaration or definition" } */
while (x < 10)
#pragma omp declare simd simdlen (8) aligned (b : 8 * sizeof (int))
extern int f4 (int a, int *b, int c); /* { dg-error "must be followed by function declaration or definition" } */
{
lab:
#pragma omp declare simd simdlen (8) aligned (b : 8 * sizeof (int))
extern int f5 (int a, int *b, int c); /* { dg-error "must be followed by function declaration or definition" } */
x++; /* { dg-error "expected expression before" "" { target *-*-* } .-1 } */
}
return x;
}
int
f2 (int x)
{
if (x)
extern int f6 (int a, int *b, int c); /* { dg-error "expected expression before" } */
while (x < 10)
extern int f7 (int a, int *b, int c); /* { dg-error "expected expression before" } */
{
lab:
extern int f8 (int a, int *b, int c); /* { dg-error "a label can only be part of a statement and a declaration is not a statement" } */
x++;
}
return x;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment