- Feb 19, 2020
-
-
Jinxin (Brian) Yang authored
This commit implements rule: A loop iteration variable for a sequential loop in a parallel or task generating construct is private in the innermost such construct that encloses the loop. A Simple example: ``` i = -1 <== Scope 0 j = -1 !$omp parallel <== Scope 1 print *,i,j <-- both are shared (Scope 0) !$omp parallel <== Scope 2 print *,i,j <-- a) i is shared (Scope 0), j is private (Scope 2) !$omp do <== Scope 3 do i=1, 10 <-- i is private (Scope 3) do j=1, 10 <-- b) j is private (Scope 2, not 3!) enddo enddo print *,i,j <-- c) i is shared (Scope 0), j is private (Scope 2) !$omp end parallel print *,i,j <-- both are shared (Scope 0) !$omp end parallel print *,i,j <-- both are shared (Scope 0) end ``` Ideally the above rule solves a), b), and c) but a) is left as a TODO because it is better to handle the data-sharing attribute conflicts along with the rules for "Predetermined DSA on Clauses". The basic idea is when visiting the `DoConstruct` node within an OpenMP construct, if the do-loop is not associated (like `i` loop is associated with `!$omp do`) AND the do-loop is in the parallel/task generating construct, resolve the loop index to be private to that innermost construct. In the above example, `j` loop is not associated (then it is sequential) and the innermost parallel/task generating construct that encloses the `j` loop is the `parallel` construct marked with `<== Scope 2`, so `j` is private to that construct. To do that, I also need to change the prototype of those `ResolveOmp*` functions to allow specifiying the `scope` because the new symbol for `j` should be created in Scope 2 and all the `symbol` field of `Name j` in that `parallel` construct should be fixed, such as c). Original-commit: flang-compiler/f18@69a845283b058a3644053ec58b00d3361f4d4a59 Reviewed-on: https://github.com/flang-compiler/f18/pull/976
-
- Feb 18, 2020
-
-
jeanPerier authored
RFC: FIR Merge - PR1: Add PFTBuilder structure to help lowering the parse-tree Original-commit: flang-compiler/f18@f28afa7138a55c0af3aadc8028844012ce8e6191 Reviewed-on: https://github.com/flang-compiler/f18/pull/959
-
- Feb 17, 2020
-
-
Jean Perier authored
The Pre-FIR Tree structure is a transient data structure that is meant to be built from the parse tree just before lowering to FIR and that will be deleted just afterwards. It is not meant to perfrom optimization analysis and transformations. It only provides temporary information, such as label target information or parse tree parent nodes, that is meant to be used to lower the parse tree structure into FIR operations. A PFTBuilder class builds the Pre-Fir Tree from the parse-tree. A pretty printer is available to visualize this data structure. - Lit tests are added to: 1. that the PFT tree structure is as expected 2. that the PFT captures all intented nodes - Cmake changes: Prevent warnings inisde LLVM headers when compiling flang The issue is that some LLVM headers define functions where the usage of the parameters depend on environment ifdef. See for instance Size in: https://github.com/llvm/llvm-project/blob/5f940220bf9438e95ffa4a627ac1591be1e1ba6e/llvm/include/llvm/Support/Compiler.h#L574 Because flang is build with -Werror and -Wunused-parameter is default in clang, this may breaks build in some environments (like with clang9 on macos). A solution would be to add -Wno-unused-parameter to flang CmakLists.txt, but it is wished to keep this warning on flang sources for quality purposes. Fixing LLVM headers is not an easy task and `[[maybe_unused]]` is C++17 and cannot be used yet in LLVM headers. Hence, this fix simply silence warnings coming from LLVM headers by telling CMake they are to be considered as if they were system headers. - drone.io changes: remove llvm 6.0 from clang config in drone.io and link flang with libstdc++ instead of libc++ llvm-dev resolved to llvm-6.0 in clang builds on drone.io. llvm 6.0 too old. LLVM packages are linked with libstdc++ standard library whereas libc++ was used for flang. This caused link time failure when building clang. Change frone.io to build flang with libc++. Note: This commit does not reflect an actual work log, it is a feature based split of the changes done in the FIR experimental branch. The related work log can be found in the commits between: 864898cbe509d032abfe1172ec367dbd3dd92bc1 and 137c23da9c64cf90584cf81fd646053a69e91f63 Other changes come from https://github.com/flang-compiler/f18/pull/959 review. Original-commit: flang-compiler/f18@edb0943bca4b81689f320bda341040bf255d6e2e Reviewed-on: https://github.com/flang-compiler/f18/pull/959
-
Jean Perier authored
Note: This commit does not reflect an actual work log, it is a feature based split of the changes done in the FIR experimental branch. The related work log can be found in the commits between: https://github.com/schweitzpgi/f18/commit/8c320e3bf2c3e9cdac66c81db3bf4634bf972e1d and: https://github.com/schweitzpgi/f18/commit/9b9ea05f9a75608c7bb5372c56bf7b9363569a69 Original-commit: flang-compiler/f18@00d8d5121cdaed09e584a0aea7d59baf322bfaa3 Reviewed-on: https://github.com/flang-compiler/f18/pull/959 Tree-same-pre-rewrite: false
-
- Feb 15, 2020
-
-
psteinfeld authored
Semantic check for C708 Original-commit: flang-compiler/f18@4d4b375d14810223badee7b47a151bc1d7ebab5b Reviewed-on: https://github.com/flang-compiler/f18/pull/981
-
Pete Steinfeld authored
An entity declared with the CLASS keyword shall be a dummy argument or have the ALLOCATABLE or POINTER attribute. Implementing this check revealed a problem in the test resolve44.cpp. It also showed that we were doing semantic checking on the entities created by the compiler for LOCAL and LOCAL_INIT locality-specs. So I changed the creation of symbols associated with LOCAL and LOCAL_INIT locality-specs to be host associated with the outer symbol rather than new object entities. In the process, I also changed things so that the `parser::Name` associated with the newly created symbols was set to the symbol rather than being set to nullptr. Original-commit: flang-compiler/f18@5dd0b0bbe811a908374b2907bb38c75ca76127d2 Reviewed-on: https://github.com/flang-compiler/f18/pull/981
-
- Feb 14, 2020
-
-
David Truby authored
Original-commit: flang-compiler/f18@403faf847d0beacac26421bc82318aaef0e973c9 Reviewed-on: https://github.com/flang-compiler/f18/pull/983
-
Peter Klausler authored
Progress on Fortran I/O runtime Original-commit: flang-compiler/f18@47ed180b67cae9d61251574e94c97675d5c998b1 Reviewed-on: https://github.com/flang-compiler/f18/pull/982
-
peter klausler authored
Use internal units for internal I/O state Replace use of virtual functions reference_wrapper Internal formatted output to array descriptor Delete dead code Begin list-directed internal output Refactorings and renamings for clarity List-directed external I/O (character) COMPLEX list-directed output Control list items First cut at unformatted I/O More OPEN statement work; rename class to ExternalFileUnit Complete OPEN (exc. for POSITION=), add CLOSE() OPEN(POSITION=) Flush buffers on crash and for terminal output; clean up Documentation Fix backquote in documentation Fix typo in comment Begin implementation of input Refactor binary floating-point properties to a new header, simplify numeric output editing Dodge spurious GCC 7.2 build warning Address review comments Original-commit: flang-compiler/f18@9c4bba11cf2329575ea9ee446f69e9caa797135c Reviewed-on: https://github.com/flang-compiler/f18/pull/982
-
- Feb 12, 2020
-
-
psteinfeld authored
Semantic checks for constraints on types Original-commit: flang-compiler/f18@2efdf12f6a2533980dfcfc6c3bb375e65ac07a67 Reviewed-on: https://github.com/flang-compiler/f18/pull/978
-
Pete Steinfeld authored
I implemented and added tests for constraints C703, C704, C705, C706, and C796. In some cases, the code and/or test already existed, and all I did was add a notation indicating the associated constraint. Original-commit: flang-compiler/f18@49a64c4c2374e930f6890b270289a6f49ba63edd Reviewed-on: https://github.com/flang-compiler/f18/pull/978
-
psteinfeld authored
Updated the description of `evaluate::Expr` types Original-commit: flang-compiler/f18@92884fa4f63e5186fc23d185b9d163ac28ff39d5 Reviewed-on: https://github.com/flang-compiler/f18/pull/979
-
Pete Steinfeld authored
Original-commit: flang-compiler/f18@75adddd504577a295f0c906aa049bd47ce2b4f2e Reviewed-on: https://github.com/flang-compiler/f18/pull/979
-
- Feb 11, 2020
-
-
Tim Keith authored
Fix compilation error on macOS Original-commit: flang-compiler/f18@204c67d7b6721c38d24cb2ffb3d812350f6d146b Reviewed-on: https://github.com/flang-compiler/f18/pull/977
-
Tim Keith authored
The call to `std::min` failed to compile with GCC on macOS due to type inference because `std::size_t` is `long unsigned int` but `std::int64_t` is `long long int`. Original-commit: flang-compiler/f18@c342575a9e0217fa3252b70b8ef3eac0236a58e3 Reviewed-on: https://github.com/flang-compiler/f18/pull/977
-
- Feb 10, 2020
-
-
jeanPerier authored
Fix issues comming from clang-10 warnings Original-commit: flang-compiler/f18@90e6448255d9489eeb3081a9fda9d320caf8b3e3 Reviewed-on: https://github.com/flang-compiler/f18/pull/972
-
Jean Perier authored
- Remove SubprogramDetails copy ctor - Prevent copies in range based loops over symbols - Remove unsued var Original-commit: flang-compiler/f18@16543d22f74e9421ecb4078818f4c1970bac0a5d Reviewed-on: https://github.com/flang-compiler/f18/pull/972
-
- Feb 08, 2020
-
-
psteinfeld authored
Semantic checks for C702 Original-commit: flang-compiler/f18@351a7d5ea6264cc58a3fd7a20e79442c41f8dd68 Reviewed-on: https://github.com/flang-compiler/f18/pull/973
-
Pete Steinfeld authored
C702 (R701) A colon shall not be used as a type-param-value except in the declaration of an entity that has the POINTER or ALLOCATABLE attribute. I added code to the visitor for a TypeDeclarationStmt to check for the 'LEN' type parameter for strings and to loop over the type parameters for derived types. I also ran into a few situations where previous tests had erroneously used a colon for type parameters without either the POINTER or ALLOCATABLE attribute and fixed them up. Original-commit: flang-compiler/f18@a1a95bfcd1811d697f1386fe57af664b8a16ffb5 Reviewed-on: https://github.com/flang-compiler/f18/pull/973
-
- Feb 06, 2020
-
-
Jinxin (Brian) Yang authored
This refers to three rules in OpenMP 4.5 Spec 2.15.1.1: * The loop iteration variable(s) in the associated do-loop(s) of a do, parallel do, taskloop, or distribute construct is (are) private. * The loop iteration variable in the associated do-loop of a simd construct with just one associated do-loop is linear with a linear-step that is the increment of the associated do-loop. * The loop iteration variables in the associated do-loops of a simd construct with multiple associated do-loops are lastprivate. A simple example: ``` implicit none integer :: N = 1024 integer i, j, k !$omp parallel do collapse(3) do i=1, N <- i is private do j=1, N <- j is private do k=1, N <- k is private enddo enddo enddo end ``` If `collapse` clause is not present, the associated do-loop for construct `parallel do` is only `i` loop. With `collapse(n)`, `i`, `j`, and `k` are all associated do-loops and the loop index variables are private to the OpenMP construct: ``` implicit none !DEF: /MainProgram1/n ObjectEntity INTEGER(4) integer :: n = 1024 !DEF: /MainProgram1/i ObjectEntity INTEGER(4) !DEF: /MainProgram1/j ObjectEntity INTEGER(4) !DEF: /MainProgram1/k ObjectEntity INTEGER(4) integer i, j, k !$omp parallel do collapse(3) !DEF: /MainProgram1/Block1/i (OmpPrivate) HostAssoc INTEGER(4) !REF: /MainProgram1/n do i=1,n !DEF: /MainProgram1/Block1/j (OmpPrivate) HostAssoc INTEGER(4) !REF: /MainProgram1/n do j=1,n !DEF: /MainProgram1/Block1/k (OmpPrivate) HostAssoc INTEGER(4) !REF: /MainProgram1/n do k=1,n end do end do end do end program ``` This implementation assumes that the structural checks for do-loops are done at this point, for example the `n` in `collapse(n)` should be no more than the number of actual perfectly nested do-loops, etc.. Original-commit: flang-compiler/f18@572a57d3d0d785bb3f2aad9e890ef498c1214309 Reviewed-on: https://github.com/flang-compiler/f18/pull/962
-
- Feb 05, 2020
-
-
jeanPerier authored
[flang] Merge pull request flang-compiler/f18#968 from flang-compiler/jpr-fix-clang-template-step-limit Fix template step limit issue with clang Original-commit: flang-compiler/f18@d4cd378290feb05ace2d549fb74db3e48b962f10 Reviewed-on: https://github.com/flang-compiler/f18/pull/968
-
Jean Perier authored
While working on PR 959, I instanciated a `common::TupleToVariant` with ~50+ types inside the tuple. Clang would then crash after 1hr compilation with message: "constexpr evaluation hit maximum step limit; possible infinite loop" After investigating, it turned out clang handles very badly the way `common::AreTypesDistinctHelper` was implemented. Its "number of steps" was exponential with the number of types. This fix makes this number quadratic which solves the issue. Original-commit: flang-compiler/f18@4542cb57082eaf578799c76482d4b706ae5da077 Reviewed-on: https://github.com/flang-compiler/f18/pull/968
-
Peter Klausler authored
Formatted output editing & initial buffer framing code Original-commit: flang-compiler/f18@003b664229a91b1692b52014ef6f9c9b65119b0d Reviewed-on: https://github.com/flang-compiler/f18/pull/950
-
peter klausler authored
Address review comments Integer output data editing (I,B,O,Z) Full integer output formatting Stub out some work in progress Progress on E output data editing E, D, EN, and ES output editing done Fw.d output editing Real G output editing G output editing for reals Make environment a distinct module CHARACTER and LOGICAL output editing Minimal decimal representations for E0, F0, G0 editing Move real output editing code into its own file Fix/dodge some GCC build problems Prep work for external I/O statement state External HELLO, WORLD Fix build problem with GCC Add virtual destructors where needed Add new test Original-commit: flang-compiler/f18@c3f1774f8eee903928b7e46636edfb03425eabc0 Reviewed-on: https://github.com/flang-compiler/f18/pull/950
-
- Feb 04, 2020
-
-
psteinfeld authored
Explanation of how to implement a semantic check Original-commit: flang-compiler/f18@bedca1462b46c52cf41b5f40cd7ed9bb6cc78f29 Reviewed-on: https://github.com/flang-compiler/f18/pull/939
-
Pete Steinfeld authored
This is the story of implementing semantic checks for passing DO variables to functions with dummy arguments with INTENT(OUT) or INTENT(INOUT). Original-commit: flang-compiler/f18@889f90913f280f285eb9960a0e0baadfd43a555f Reviewed-on: https://github.com/flang-compiler/f18/pull/939
-
- Jan 30, 2020
-
-
Tim Keith authored
Fix another bug checking simple contiguity Original-commit: flang-compiler/f18@cd371e9a2ab66c31c6df77c0fa3052a80f00908c Reviewed-on: https://github.com/flang-compiler/f18/pull/961
-
Tim Keith authored
The test still wasn't correct for structure components. If the last part-ref is a non-array or a single array element, but the whole ArrayRef has non-zero rank, it is not contiguous. Otherwise, if there are subscripts on the last part-ref they can be checked normally. Add some tests for cases that were previously failing, and also for cases with vector subscripts. Original-commit: flang-compiler/f18@aa0a0887325bd1fc6c3a1ad40fc6711d2e458a1c Reviewed-on: https://github.com/flang-compiler/f18/pull/961
-
psteinfeld authored
Semantic checks for deallocating entities with IMPURE FINAL procedures Original-commit: flang-compiler/f18@61da1f9e5c59cedb02026954a73ab30d8319a66c Reviewed-on: https://github.com/flang-compiler/f18/pull/954
-
Pete Steinfeld authored
You cannot call an IMPURE procedure in a DO CONCURRENT construct. One way that can happen is if an entity with an IMPURE FINAL procedure gets deallocated. Similar to the checks for deallocating coarrays, there are three ways that an entity can get deallocated that are applicable to DO CONCURRENT constructs -- an actual DEALLOCATE statement, block exit, and assignment. This change depends on the utility function `HasImpureFinal()` in tools.h to determine if an entity has a derived type with an IMPURE FINAL procedure. In the course of testing this change, I realized that this check is incorrect, but the code specific to DO CONCURRENT is independent of the check, so I might as well implement it. Original-commit: flang-compiler/f18@d2294ff511aebd64889df57d02325bd6fcdf914a Reviewed-on: https://github.com/flang-compiler/f18/pull/954
-
- Jan 29, 2020
-
-
Jinxin (Brian) Yang authored
Remove `default` case for OmpSectionsDirective (only two enum values) Original-commit: flang-compiler/f18@d98bf8494e2e017ed9a7e1d3c93688c379c01bf3 Reviewed-on: https://github.com/flang-compiler/f18/pull/960
-
Jinxin Yang authored
Original-commit: flang-compiler/f18@3f37e0dbaf32f1127553be2149915cab1b93cdcf Reviewed-on: https://github.com/flang-compiler/f18/pull/960
-
Jinxin (Brian) Yang authored
This is an extended framework based on the previous work that addresses the NR on OpenMP directives/clauses (b2ea520). In this change: * New `OmpVisitor` is created (ResolveNamesVisitor derives from it) to create necessary scopes for certain OpenMP constructs. This is along with the regular Fortran NR process. * Old `OmpVisitor` is adjusted and converted to a standalone visitor-- `OmpAttributeVisitor`. This is used to walk through the OpenMP constructs and do the NR for variables on the OpenMP directives or data references within the OpenMP constructs. "Do the NR" here means that based on the NR results of the regular Fortran NR, fix the symbols of `Names` related to the OpenMP constructs. Note that there is an `OmpContext` in this visitor (similar to the one in `OmpStructureChecker`), this is necessary when dealing with the nested OpenMP constructs in the future. Given an OpenMP code: ``` real*8 a, b a = 1. b = 2. !$omp parallel private(a) a = 3. b = 4. !$omp end parallel print *, a, b end ``` w/o -fopenmp: ``` real*8 a, b !REF: /MainProgram1/a a = 1. !REF: /MainProgram1/b b = 2. !!!! OMP parallel !REF: /MainProgram1/a a = 3. !REF: /MainProgram1/b b = 4. !!!! OMP end parallel !REF: /MainProgram1/a !REF: /MainProgram1/b print *, a, b end ``` w/ -fopenmp: ``` real*8 a, b !REF: /MainProgram1/a a = 1. !REF: /MainProgram1/b b = 2. !$omp parallel private(a) <-- new Symbol for 'a' created !DEF: /MainProgram1/Block1/a (OmpPrivate) HostAssoc REAL(8) a = 3. <-- fix the old symbol with new Symbol in parallel scope !REF: /MainProgram1/b b = 4. <-- do nothing because by default it is shared in this scope !$omp end parallel !REF: /MainProgram1/a !REF: /MainProgram1/b print *, a, b end ``` Please note that this is a framework update, there are still many things on the TODO list for finishing the NR for OpenMP (based on the `OpenMP-semantics.md` design doc), which will be on top of this framework. Some TODO items: - Create a generic function to go through all the rules for deciding `predetermined`, `explicitly determined`, and `implicitly determined` data-sharing attributes. (This is the next biggest part) - Handle `Array Sections` and `Array or Structure Element`. - Take association into consideration for example Pointer association, `ASSOCIATE` construct, and etc. - Handle all the name resolution for directives/clauses that have `parser::Name`. * N.B. Extend `AddSourceRange` to apply to current and parent scopes - motivated by a few cases that need to call `AddSourceRange` for current & parent scopes; the extension should be safe - global scope is not included Original-commit: flang-compiler/f18@0c3c39d30e3f166a6a1303337c5fd7eead720fd0 Reviewed-on: https://github.com/flang-compiler/f18/pull/940
-
- Jan 28, 2020
-
-
psteinfeld authored
More checklist items Original-commit: flang-compiler/f18@32eb0d79c3a334d15ed1dc351619be9fda6b2a9f Reviewed-on: https://github.com/flang-compiler/f18/pull/956
-
- Jan 25, 2020
-
-
Pete Steinfeld authored
I added more items when reviewing some actual pull request comments. Original-commit: flang-compiler/f18@195d807ff221e4247ec5609e8e816e81dab5df94 Reviewed-on: https://github.com/flang-compiler/f18/pull/956
-
- Jan 28, 2020
-
-
Alexis Perry authored
Updated CMake files accordingly, using better regex Updated license headers to match new extension and fit within 80 columns Updated other comments within files that referred to the old extension Original-commit: flang-compiler/f18@ae7721e611918631d1e3821dbb60f5ffcd9a69b1 Reviewed-on: https://github.com/flang-compiler/f18/pull/958
-
David Truby authored
Original-commit: flang-compiler/f18@21adbc7e05b2454ba3fc725b4697748f98599471 Reviewed-on: https://github.com/flang-compiler/f18/pull/943
-
Tim Keith authored
Fix bugs detecting impure calls Original-commit: flang-compiler/f18@db5ebec5156f3f93fb99358192307298c99fc3c4 Reviewed-on: https://github.com/flang-compiler/f18/pull/951
-
- Jan 26, 2020
-
-
Tim Keith authored
Change Traverse to visit the actual arguments of structure constructors. Change FindImpureCallHelper to visit the actual arguments of a call to a pure procedure in case one of them makes a call to an impure function. Original-commit: flang-compiler/f18@81a5488ee62b4324d002c348464712c930095a32 Reviewed-on: https://github.com/flang-compiler/f18/pull/951
-
- Jan 28, 2020
-
-
Tim Keith authored
Fix bug detecting simply contiguous component Original-commit: flang-compiler/f18@a8a7a8c914aecbfdaff95419eb0408aa979abe53 Reviewed-on: https://github.com/flang-compiler/f18/pull/952
-