[flang-commits] [PATCH] D111679: [flang][NFC] Document extension: scalars are trivially contiguous

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Tue Oct 12 16:02:03 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG6ee2aa126cf6: [flang][NFC] Document extension: scalars are trivially contiguous (authored by klausler).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111679/new/

https://reviews.llvm.org/D111679

Files:
  flang/docs/Extensions.md
  flang/lib/Evaluate/check-expression.cpp


Index: flang/lib/Evaluate/check-expression.cpp
===================================================================
--- flang/lib/Evaluate/check-expression.cpp
+++ flang/lib/Evaluate/check-expression.cpp
@@ -626,8 +626,12 @@
 
   Result operator()(const semantics::Symbol &symbol) const {
     const auto &ultimate{symbol.GetUltimate()};
-    if (ultimate.attrs().test(semantics::Attr::CONTIGUOUS) ||
-        ultimate.Rank() == 0) {
+    if (ultimate.attrs().test(semantics::Attr::CONTIGUOUS)) {
+      return true;
+    } else if (ultimate.Rank() == 0) {
+      // Extension: accept scalars as a degenerate case of
+      // simple contiguity to allow their use in contexts like
+      // data targets in pointer assignments with remapping.
       return true;
     } else if (semantics::IsPointer(ultimate)) {
       return false;
Index: flang/docs/Extensions.md
===================================================================
--- flang/docs/Extensions.md
+++ flang/docs/Extensions.md
@@ -175,6 +175,10 @@
 * OPEN(ACCESS='APPEND') is interpreted as OPEN(POSITION='APPEND')
   to ease porting from Sun Fortran.
 * Intrinsic subroutines EXIT([status]) and ABORT()
+* The definition of simple contiguity in 9.5.4 applies only to arrays;
+  we also treat scalars as being trivially contiguous, so that they
+  can be used in contexts like data targets in pointer assignments
+  with bounds remapping.
 
 ### Extensions supported when enabled by options
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111679.379216.patch
Type: text/x-patch
Size: 1457 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20211012/012fc414/attachment.bin>


More information about the flang-commits mailing list