Commit ca8ecd91 by Thomas Schwinge Committed by Thomas Schwinge

[PR85221] Set 'omp declare target', 'omp declare target link' attributes for…

[PR85221] Set 'omp declare target', 'omp declare target link' attributes for Fortran OpenACC 'declare'd variables

	gcc/fortran/
	PR fortran/85221
	* trans-decl.c (add_attributes_to_decl): Handle OpenACC 'declare'
	directive.
	gcc/testsuite/
	PR fortran/85221
	* gfortran.dg/goacc/declare-3.f95: New file.

From-SVN: r272453
parent 02fd3a0e
2019-06-18 Thomas Schwinge <thomas@codesourcery.com>
PR fortran/85221
* trans-decl.c (add_attributes_to_decl): Handle OpenACC 'declare'
directive.
2019-06-16 Thomas Koenig <tkoenig@gcc.gnu.org> 2019-06-16 Thomas Koenig <tkoenig@gcc.gnu.org>
* dump_parse_tree (debug): Add verison for formal arglist. * dump_parse_tree (debug): Add verison for formal arglist.
......
...@@ -1432,10 +1432,15 @@ add_attributes_to_decl (symbol_attribute sym_attr, tree list) ...@@ -1432,10 +1432,15 @@ add_attributes_to_decl (symbol_attribute sym_attr, tree list)
list = oacc_replace_fn_attrib_attr (list, dims); list = oacc_replace_fn_attrib_attr (list, dims);
} }
if (sym_attr.omp_declare_target_link) if (sym_attr.omp_declare_target_link
|| sym_attr.oacc_declare_link)
list = tree_cons (get_identifier ("omp declare target link"), list = tree_cons (get_identifier ("omp declare target link"),
NULL_TREE, list); NULL_TREE, list);
else if (sym_attr.omp_declare_target) else if (sym_attr.omp_declare_target
|| sym_attr.oacc_declare_create
|| sym_attr.oacc_declare_copyin
|| sym_attr.oacc_declare_deviceptr
|| sym_attr.oacc_declare_device_resident)
list = tree_cons (get_identifier ("omp declare target"), list = tree_cons (get_identifier ("omp declare target"),
clauses, list); clauses, list);
......
2019-06-18 Thomas Schwinge <thomas@codesourcery.com> 2019-06-18 Thomas Schwinge <thomas@codesourcery.com>
PR fortran/85221
* gfortran.dg/goacc/declare-3.f95: New file.
PR middle-end/90859 PR middle-end/90859
* c-c++-common/goacc/firstprivate-mappings-1.c: Update. * c-c++-common/goacc/firstprivate-mappings-1.c: Update.
......
! Test valid usage of the OpenACC 'declare' directive.
module mod_a
implicit none
integer :: a
!$acc declare create (a)
end module
module mod_b
implicit none
integer :: b
!$acc declare copyin (b)
end module
module mod_c
implicit none
integer :: c
!$acc declare deviceptr (c)
end module
module mod_d
implicit none
integer :: d
!$acc declare device_resident (d)
end module
module mod_e
implicit none
integer :: e
!$acc declare link (e)
end module
subroutine sub1
use mod_a
use mod_b
use mod_c
use mod_d
use mod_e
end subroutine sub1
program test
use mod_a
use mod_b
use mod_c
use mod_d
use mod_e
end program test
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