[openacc] add a warning for non-contiguous data clauses
Cesar Philippidis
cesar@codesourcery.com
Wed Aug 3 04:16:00 GMT 2016
OpenACC requires that fortran array pointers must represent contiguous
arrays. As of now, the fortran FE in trunk treats non-contiguous array
pointers as an errors, at least for explicit data clauses. This patch
relaxes this errors to warnings for two reasons:
1. A lot of existing code don't set the contiguous pointer attribute
so this error breaks working programs.
2. Array pointers can be implicitly detected by the gimplifier, and
prior to this patch, there were no diagnostics informing the user
of any potential problems with those variables.
My solution for 2) is somewhat of a kludge. This patch using an unused
TREE_VISITED bit to mark whether a decl is used inside an OpenACC region
or not for gfc_omp_privatize_by_reference langhook. I didn't really want
to modify that hook because there are a couple of other users for it,
notably is_reference inside omp-low, which do not require any special
diagnostics to be generated.
After thinking about this some more, perhaps that hook should be
extended with a needs_target_diagnostics argument for both OpenACC and
OpenMP offloaded regions. I think OpenMP has similar contiguous array
restrictions as OpenACC, at least in target code.
This patch is for gomp-4_0-branch, but would something like this be OK
for trunk?
By the way, apparently the __gcc_gfc__ format attribute doesn't support
the 'D' specifier for tree nodes, so I had to access the decl's name
directly. Since I'm not if this patch is OK, I've decided to leave that
as-is for now.
Cesar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gomp4-contiguous-pointer-warnings.diff
Type: text/x-patch
Size: 5830 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20160803/63dfd6b9/attachment.bin>
More information about the Fortran
mailing list