llvm-project
76ddb39f - [flang][acc] Avoid assert for assumed-size arrays without a descriptor (#205726)

Commit
26 days ago
[flang][acc] Avoid assert for assumed-size arrays without a descriptor (#205726) Example: ```fortran subroutine sub(a, n) real(8) :: a(n, *) integer :: n, i !$acc data no_create(a) !$acc parallel loop do i = 1, n a(1, i) = 0.0d0 end do !$acc end data end subroutine ``` An assumed-size dummy array (e.g. `real(8) :: a(n,*)`) has an unknown trailing extent and is passed without a descriptor. When the OpenACC implicit-data pass builds a data clause for such an array, `generateSeqTyAccBounds` enters the unknown-shape branch but finds no descriptor (`fir.box`) to recover bounds from, and hits: assert(false && "array with unknown dimension expected to have descriptor"); The premise is wrong: an assumed-size array legitimately has no descriptor and no recoverable bounds. Fix: return empty bounds instead of asserting. The caller only assigns bounds when non-empty, so the array is mapped without bounds — the only correct option when the extent is unknown, and sufficient for presence-only clauses (`no_create`/`present`).
Author
Parents
Loading