Hello!
I was testing an internal codebase with flang and for the following MRE I got a compiler error:
subroutine foo
integer :: bar
bar = 1
!$acc parallel loop vector reduction(+:bar)
!dir$ ivdep
do i = 1, 100, 1
bar = bar + i
end do
end subroutine foo
$ build/bin/flang-new -fopenacc t.f90
error: Semantic errors in t.f90
./t.f90:5:9: error: A DO loop must follow the PARALLEL LOOP directive
!$acc parallel loop vector reduction(+:bar)
^^^^^^^^^^^^^
This is probably an extension, but it is a common one: both nvfortran and gfortran support it and there is not even a warning about it. But for gfortran the directive should be changed: dir$
→ gcc$
, though.
So, is there a patch for this behavior somewhere downstream meant to be upstreamed?
If no, should I submit patch for this?
I have 2 possible solutions in mind:
- Change the parse tree so OpenACC constructs or DO loops are able to contain the compiler directives associated with them.
- Simply move irrelevant compiler directives before the OpenACC constructs. Basically, the needed information is preserved with this solution and can be used later.
Currently, I work on the second proposed solution because the first one seems more radical.