[flang][OpenMP] Avoid crash with MAP w/o modifiers, version >= 6.0 (#154352)

The current code will crash on the MAP clause with OpenMP version >= 6.0
when the clause does not explicitly list any modifiers. The proper fix
is to update the handling of assumed-size arrays for OpenMP 6.0+, but in
the short term keep the behavior from 5.2, just avoid the crash.
This commit is contained in:
Krzysztof Parzyszek 2025-08-19 10:18:51 -05:00 committed by GitHub
parent 9240061800
commit 8255d240a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 1 deletions

View File

@ -793,7 +793,8 @@ public:
if (name->symbol) {
name->symbol->set(
ompFlag.value_or(Symbol::Flag::OmpMapStorage));
AddToContextObjectWithDSA(*name->symbol, *ompFlag);
AddToContextObjectWithDSA(*name->symbol,
ompFlag.value_or(Symbol::Flag::OmpMapStorage));
if (semantics::IsAssumedSizeArray(*name->symbol)) {
context_.Say(designator.source,
"Assumed-size whole arrays may not appear on the %s "

View File

@ -0,0 +1,12 @@
!RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=60 %s -o - | FileCheck %s
!This shouldn't crash. Check for a symptom of a successful compilation
!CHECK: omp.map.info
subroutine f00
implicit none
integer :: x
!$omp target map(x)
!$omp end target
end