c-parser.c (c_parser_oacc_declare): Don't scan for GOMP_MAP_POINTER.

gcc/c/
	* c-parser.c (c_parser_oacc_declare): Don't scan for
	GOMP_MAP_POINTER.
	* c-typeck.c (handle_omp_array_sections): Mark data clauses with
	GOMP_MAP_FORCE_{PRESENT,TO,FROM,TOFROM} as potentially having
	zero-length subarrays.

	gcc/cp/
	* parser.c (cp_parser_oacc_declare): Don't scan for
	GOMP_MAP_POINTER.
	* semantics.c (handle_omp_array_sections): Mark data clauses with
	GOMP_MAP_FORCE_{PRESENT,TO,FROM,TOFROM} as potentially having
	zero-length subarrays.

	gcc/
	* omp-low.c (lower_omp_target): Mark data clauses with
	GOMP_MAP_FORCE_{PRESENT,TO,FROM,TOFROM} as potentially having
	zero-length subarrays.

	libgomp/
	* testsuite/libgomp.oacc-c-c++-common/zero_length_subarrays.c: New
	test.

From-SVN: r238376
This commit is contained in:
Cesar Philippidis 2016-07-15 07:13:48 -07:00 committed by Cesar Philippidis
parent f7ba880b6b
commit b1c9c068f7
10 changed files with 84 additions and 10 deletions

View File

@ -1,3 +1,9 @@
2016-07-15 Cesar Philippidis <cesar@codesourcery.com>
* omp-low.c (lower_omp_target): Mark data clauses with
GOMP_MAP_FORCE_{PRESENT,TO,FROM,TOFROM} as potentially having
zero-length subarrays.
2016-07-15 Richard Biener <rguenther@suse.de>
PR tree-optimization/71881

View File

@ -1,3 +1,11 @@
2016-07-15 Cesar Philippidis <cesar@codesourcery.com>
* c-parser.c (c_parser_oacc_declare): Don't scan for
GOMP_MAP_POINTER.
* c-typeck.c (handle_omp_array_sections): Mark data clauses with
GOMP_MAP_FORCE_{PRESENT,TO,FROM,TOFROM} as potentially having
zero-length subarrays.
2016-07-15 Jakub Jelinek <jakub@redhat.com>
PR c/71858

View File

@ -13664,11 +13664,6 @@ c_parser_oacc_declare (c_parser *parser)
case GOMP_MAP_DEVICE_RESIDENT:
break;
case GOMP_MAP_POINTER:
/* Generated by c_finish_omp_clauses from array sections;
avoid spurious diagnostics. */
break;
case GOMP_MAP_LINK:
if (!global_bindings_p ()
&& (TREE_STATIC (decl)

View File

@ -12505,6 +12505,10 @@ handle_omp_array_sections (tree c, enum c_omp_region_type ort)
case GOMP_MAP_ALWAYS_TOFROM:
case GOMP_MAP_RELEASE:
case GOMP_MAP_DELETE:
case GOMP_MAP_FORCE_TO:
case GOMP_MAP_FORCE_FROM:
case GOMP_MAP_FORCE_TOFROM:
case GOMP_MAP_FORCE_PRESENT:
OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION (c) = 1;
break;
default:

View File

@ -1,3 +1,11 @@
2016-07-15 Cesar Philippidis <cesar@codesourcery.com>
* parser.c (cp_parser_oacc_declare): Don't scan for
GOMP_MAP_POINTER.
* semantics.c (handle_omp_array_sections): Mark data clauses with
GOMP_MAP_FORCE_{PRESENT,TO,FROM,TOFROM} as potentially having
zero-length subarrays.
2016-07-11 Jason Merrill <jason@redhat.com>
* decl.c (store_parm_decls): Remove check for void parm.

View File

@ -35258,11 +35258,6 @@ cp_parser_oacc_declare (cp_parser *parser, cp_token *pragma_tok)
case GOMP_MAP_DEVICE_RESIDENT:
break;
case GOMP_MAP_POINTER:
/* Generated by c_finish_omp_clauses from array sections;
avoid spurious diagnostics. */
break;
case GOMP_MAP_LINK:
if (!global_bindings_p ()
&& (TREE_STATIC (decl)

View File

@ -5002,6 +5002,10 @@ handle_omp_array_sections (tree c, enum c_omp_region_type ort)
case GOMP_MAP_ALWAYS_TOFROM:
case GOMP_MAP_RELEASE:
case GOMP_MAP_DELETE:
case GOMP_MAP_FORCE_TO:
case GOMP_MAP_FORCE_FROM:
case GOMP_MAP_FORCE_TOFROM:
case GOMP_MAP_FORCE_PRESENT:
OMP_CLAUSE_MAP_MAYBE_ZERO_LENGTH_ARRAY_SECTION (c) = 1;
break;
default:

View File

@ -16210,6 +16210,10 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
case GOMP_MAP_ALWAYS_FROM:
case GOMP_MAP_ALWAYS_TOFROM:
case GOMP_MAP_RELEASE:
case GOMP_MAP_FORCE_TO:
case GOMP_MAP_FORCE_FROM:
case GOMP_MAP_FORCE_TOFROM:
case GOMP_MAP_FORCE_PRESENT:
tkind_zero = GOMP_MAP_ZERO_LEN_ARRAY_SECTION;
break;
case GOMP_MAP_DELETE:

View File

@ -1,3 +1,8 @@
2016-07-15 Cesar Philippidis <cesar@codesourcery.com>
* testsuite/libgomp.oacc-c-c++-common/zero_length_subarrays.c: New
test.
2016-07-03 H.J. Lu <hongjiu.lu@intel.com>
PR middle-end/71734

View File

@ -0,0 +1,45 @@
/* Exercise zero-length sub-arrays. */
const int n = 10;
void
subzero_present (int *a, int n)
{
#pragma acc data present (a[0:n])
;
#pragma acc data pcopy (a[0:n])
;
#pragma acc data pcopyin (a[0:n])
;
#pragma acc data pcopyout (a[0:n])
;
}
void
subzero (int *a, int n)
{
#pragma acc data create (a[0:n])
;
#pragma acc data copy (a[0:n])
;
#pragma acc data copyin (a[0:n])
;
#pragma acc data copyout (a[0:n])
;
}
int
main ()
{
int a[n];
#pragma acc data copy (a[0:n])
{
subzero_present (a, 0);
}
subzero (a, 0);
return 0;
}