Am 17.06.26 um 10:22 schrieb Richard Biener:
We generally do not what to have user-facing flags that say
"it might generate wrong-code". Instead we'd have asserting
flags from the user, like -fdoconcurrent-are-parallelizable. But
as the underlying issue is not visible to the user this doesn't
work in this case
There are restrictions on DO CONCURRENT in the standard, see
11.1.7.5 Additional semantics for DO CONCURRENT constructs .
An important one is
If a variable has unspecified locality
if it is referenced in an iteration it shall either be previously
defined during that iteration, or shall not be defined or become
undefined during any other iteration; if it is defined or becomes
undefined by more than one iteration it becomes undefined when the loop
terminates.
If the user program does not adhere to the standard, it is broken,
and the compiler can do whatever. What is currently not clear to
me is if such an option would break standard-conforming code or
not.
So please do not add such flag (flags need to be preserved
forever). Iff you really agree that you want it, use a
--parm instead that we can freely remove.
But then, why not do this at the optimization phase of
fortran and detect the problematic setup (temporaries
it was, IIRC)? Or even, when you detect them, mark
them as to be localized? Possibly both are not easily
possible if there's function calls involved that might be
We could (and should) warn about violations of the DO CONCURRENT
semantics. I have just opened PR 125864 for that; this might
educate users, at least a bit.
But if -fdoconcurrent-are-parallelizable just asserts that the user
sticks to the standard, then we should not add such an option
(never mind what name).
Best regards
Thomas