[Patch] Fortran: %re/%im fixes for OpenMP/OpenACC + gfc_is_simplify_contiguous

Tobias Burnus tobias@codesourcery.com
Mon Feb 8 17:50:25 GMT 2021


Found when looking at Julian's 3/4 OpenACC patch, which has not
yet been committed (and needs still to be revised a bit.)

The fix (a) avoids an ICE when Julian's patch has been applied.
The patch (b) just makes one error message less confusing.

The testcase shows that only %re/%im run reach the new code as
%kind/%len are != EXPR_VARIABLE. (The error message is slightly
misleading if the 'list item'/'var' is not a variable.)


(a) We need to handle REF_INQUIRY gfc_is_simplify_contiguous.

That function is used for 'is_contiguous(a(:)%re)', but it works
without this patch and simplifies already to .false.
And it is used in openmp.c, which can ICE without this patch.

(b) Just makes the error message nicer - as only EXPR_VARIABLE
reaches that code, only %re and %im are mentioned in the
error message.

(Actually, it is not completely clear whether %re/%im are invalid
or not; I think they should be – but one can argue otherwise.
For OpenMP I just saw that it is tacked internally in Issue 2661,
for OpenACC it is tracked as Issue 346 – but neither has been
discussed, yet.)

OK for mainline?

Tobias

PS: '%re'/'%im' permit accessing the real/imaginary part of a
complex variable as lvalue (in the C++ sense) and also permit
"var(:)%re = 1.0", which real(z) or imag(z) does not permit.

var%kind == kind(var), but derived types also permit
parameterized derived types (PDT), which can use '%foo' for respective
'len' and 'kind' components.

-----------------
Mentor Graphics (Deutschland) GmbH, Arnulfstrasse 201, 80634 München Registergericht München HRB 106955, Geschäftsführer: Thomas Heurung, Frank Thürauf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cmplx-omp-oacc-v2.diff
Type: text/x-patch
Size: 4132 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20210208/3ca5c3a8/attachment-0001.bin>


More information about the Gcc-patches mailing list