commit | 7f0fbe8a87b8fe769c1bc8de31fb690b34709e52 | [log] [tgz] |
---|---|---|
author | Slava Zakharin <szakharin@nvidia.com> | Tue Jun 06 16:12:49 2023 -0700 |
committer | Copybara-Service <copybara-worker@google.com> | Tue Jun 06 20:27:15 2023 -0700 |
tree | 3abaa9c88eb6df6e9d88de154c0a863d7e48b2f0 | |
parent | 92f85fb5e86b6f3dcf95487a4c2b3c9eda680994 [diff] |
[flang][hlfir] Enable assignments with allocatable components. The TODO was left there to verify that Assign() runtime handles overlaps of allocatable components. It did not, and this change-set fixes it. Note that the same Assign() issue can be reproduced without HLFIR. In the following example the LHS would be reallocated before value of RHS (essentially, the same memory) is read: ``` program main type t1 integer, allocatable :: a(:) end type t1 type(t1) :: x, y allocate(x%a(10)) do i =1,10 x%a(i) = 2*i end do x = x print *, x%a deallocate(x%a) end program main ``` The test's output would be incorrect (though, this depends on the memory reuse by malloc): 0 0 0 0 10 12 14 16 18 20 It is very hard to add a Flang unittest exploiting derived types. Reviewed By: klausler Differential Revision: https://reviews.llvm.org/D152306 GitOrigin-RevId: 6e4984a9d5f34f68f29779b07fff580639bd2f73
Flang is a ground-up implementation of a Fortran front end written in modern C++. It started off as the f18 project (https://github.com/flang-compiler/f18) with an aim to replace the previous flang project (https://github.com/flang-compiler/flang) and address its various deficiencies. F18 was subsequently accepted into the LLVM project and rechristened as Flang.
Please note that flang is not ready yet for production usage.
Read more about flang in the docs directory. Start with the compiler overview.
To better understand Fortran as a language and the specific grammar accepted by flang, read Fortran For C Programmers and flang's specifications of the Fortran grammar and the OpenMP grammar.
Treatment of language extensions is covered in this document.
To understand the compilers handling of intrinsics, see the discussion of intrinsics.
To understand how a flang program communicates with libraries at runtime, see the discussion of runtime descriptors.
If you're interested in contributing to the compiler, read the style guide and also review how flang uses modern C++ features.
If you are interested in writing new documentation, follow LLVM's Markdown style guide.
Consult the Getting Started with Flang for information on building and running flang.