Skip to content

Commit 394dc51

Browse files
Fix volatile type handling in openmp target data mappings
1 parent 2735369 commit 394dc51

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

flang/lib/Lower/ConvertExprToHLFIR.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,10 @@ class HlfirDesignatorBuilder {
465465
// hlfir.designate result will be a pointer/allocatable.
466466
PartInfo partInfo;
467467
mlir::Type componentType = visitComponentImpl(component, partInfo).second;
468-
mlir::Type designatorType = fir::ReferenceType::get(componentType);
468+
const auto isVolatile =
469+
fir::isa_volatile_type(partInfo.base.value().getBase().getType());
470+
mlir::Type designatorType =
471+
fir::ReferenceType::get(componentType, isVolatile);
469472
fir::FortranVariableFlagsAttr attributes =
470473
Fortran::lower::translateSymbolAttributes(getBuilder().getContext(),
471474
component.GetLastSymbol());

0 commit comments

Comments
 (0)