[flang-commits] [PATCH] D91215: [flang] Implement runtime support for basic ALLOCATE/DEALLOCATE

Jean Perier via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu Nov 12 06:54:54 PST 2020


jeanPerier added inline comments.


================
Comment at: flang/runtime/allocatable.cpp:52
+  INTERNAL_CHECK(zeroBasedDim >= 0 && zeroBasedDim < descriptor.rank());
+  auto dim{descriptor.GetDimension(zeroBasedDim)};
+  dim.SetBounds(lower, upper);
----------------
I finally was able to test end-to-end and there is a very sneaky issue here, `auto dim` is making a copy of the dimension instead of taking it by reference (at least for me using gcc 8.3, I do not know what is the C++ type resolution here).
Both:
`auto& dim{descriptor.GetDimension(zeroBasedDim)};`
or
`descriptor.GetDimension(zeroBasedDim).SetBounds(lower, upper);`
fixed the issue for me.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D91215



More information about the flang-commits mailing list