https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111042

            Bug ID: 111042
           Summary: [OpenMP] 'allocate' clause and combined directive -
                    impove diagnostic, ICE because of missing diagnostic
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: diagnostic, ice-on-invalid-code, openmp
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

At least on spec level, the problem in the following is 'loop' consumes the
'private' clause but does not take the 'allocate'.

Thus, the 'allocate' clause remains - but it is not applied to any leaf
construct as there is no data-privatization clause. That's invalid as a clause
needs to apply to at least one leaf construct in a combined/composite
construct.


(A) Fortran: The following is accepted but then gives an ICE in
gimplify_omp_loop.

The original dump shows 'loop private(var) allocate(allocator(1):var)' but
that's invalid as that kind of clause it not permitted for 'loop':

EXPECTED: There is an error message + 'allocate' is not put on the 'loop'
clause.


use omp_lib
implicit none
integer :: var, i
!$omp target teams loop allocate(omp_default_mem_alloc : var) private(var)
do i=1,5
end do
end


(B) C/C++ – The code is rejected with:

error: ‘var’ specified in ‘allocate’ clause but not in an explicit
privatization clause

While technically correct, the error is misleading as it only applies to a
particular leaf construct.


Expected: The error makes clearer that this applies only after splitting.



Notes:

* 'omp target teams' is fine – the 'private(var)' ends up only with 'teams';
the 'allocate' shows up for both in the original dump, but that should be
harmless.

* Issue found via https://github.com/SOLLVE/sollve_vv/pull/761

Reply via email to