https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107227
Bug ID: 107227 Summary: Compiler bug in private allocatable array in OpenACC compute statement Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgomp Assignee: unassigned at gcc dot gnu.org Reporter: shb at gatech dot edu CC: jakub at gcc dot gnu.org Target Milestone: --- The program below does not compile (nor does any variant of it involving allocatable statements that I can think of). ``` program main integer :: i real, allocatable :: arr(:) allocate(arr(10)) !$acc parallel loop private(arr) do i=1,10 arr=1.0 end do end ``` The error is ``` !$acc parallel loop private(arr) | ^ internal compiler error: in expand_oacc_for, at omp-expand.cc:7660 ``` A version of this suggested by Mat Colgrove also does not work: ``` program main integer :: i real, allocatable :: arr(:) allocate(arr(10)) !$acc parallel loop private(arr(1:10) do i=1,10 arr=1.0 end do end ``` with error ``` 5 | !$acc parallel loop private(arr(1:10)) | 1 Error: Syntax error in OpenMP variable list at (1) ``` These appear to be ICE compiler bugs as they are permitted by quite old OpenaCC standards (and are seemingly typical use cases of OpenACC in Fortran). nvhpc compilers work fine for this. The compile statement is `gfortran -foffload-options=-march=gfx90a -fopenacc test.f90` with offloading onto an AMD MI210.