[gomp4] fix an ICE involving assumed-size arrays

Cesar Philippidis cesar@codesourcery.com
Tue Aug 30 21:55:00 GMT 2016


Usually a data clause would would have OMP_CLAUSE_SIZE set, but not all
do. In the latter case, lower_omp_target falls back to using size of the
type of the variable specified in the data clause. However, in the case
of assumed-size arrays, the size of the type may be NULL because its
undefined. My fix for this solution is to set the size to one byte if
the size of the type is NULL. This solution at least allows the runtime
the opportunity to remap any data already present on the accelerator.
However, if the data isn't present on the accelerator, this will likely
result in some sort of segmentation fault on the accelerator.

The OpenACC spec is not clear how the compiler should handle
assumed-sized arrays when the user does not provide an explicit data
clause with a proper subarray. It was tempting to make such implicit
variables errors, but arguably that would affect usability. Perhaps I
should a warning for implicitly used assumed-sizes arrays?

I've applied this patch to gomp-4_0-branch. It looks like OpenMP has a
similar problem.

Cesar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gomp4-assumed.diff
Type: text/x-patch
Size: 1842 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20160830/d2fdc9e3/attachment.bin>


More information about the Gcc-patches mailing list