platform/upstream/llvm.git
6 years ago[flang] More documentation. These changes fix two bugs noted in f18 issue#121.
peter klausler [Thu, 12 Jul 2018 21:58:06 +0000 (14:58 -0700)]
[flang] More documentation.  These changes fix two bugs noted in f18 issue#121.

Original-commit: flang-compiler/f18@f386472c5ce6cf2f4f485c118213ae3fae6040e3
Reviewed-on: https://github.com/flang-compiler/f18/pull/122
Tree-same-pre-rewrite: false

6 years ago[flang] Allow empty statements and improve error recovery error messages.
peter klausler [Thu, 12 Jul 2018 21:46:23 +0000 (14:46 -0700)]
[flang] Allow empty statements and improve error recovery error messages.

Original-commit: flang-compiler/f18@018e81e2c441ca54763e617a42457100c1291b42
Reviewed-on: https://github.com/flang-compiler/f18/pull/122
Tree-same-pre-rewrite: false

6 years ago[flang] Merge pull request flang-compiler/f18#120 from flang-compiler/tsk1
Tim Keith [Thu, 12 Jul 2018 17:15:46 +0000 (10:15 -0700)]
[flang] Merge pull request flang-compiler/f18#120 from flang-compiler/tsk1

Support intent-stmt and resolve subprogram prefixes and suffixes.

Original-commit: flang-compiler/f18@2206d453e1e7554f09ab01cfb5da8d48b5691cfd
Reviewed-on: https://github.com/flang-compiler/f18/pull/120

6 years ago[flang] Sort enumerators in `enum class Attr`.
Tim Keith [Thu, 12 Jul 2018 17:14:58 +0000 (10:14 -0700)]
[flang] Sort enumerators in `enum class Attr`.

Original-commit: flang-compiler/f18@ce43e4e556e891e68d36377add88fecd13ab4f2e
Reviewed-on: https://github.com/flang-compiler/f18/pull/120

6 years ago[flang] Support intent-stmt and resolve subprogram prefixes and suffixes.
Tim Keith [Thu, 12 Jul 2018 00:45:13 +0000 (17:45 -0700)]
[flang] Support intent-stmt and resolve subprogram prefixes and suffixes.

Recognize `IntentStmt` and use `HandleAttributeStmt()` to implement it
as is done with other attribute statements. Add `Attr::INTENT_INOUT` as
a separate attribute for `INTENT(INOUT)`.

Collect attributes from the prefix and suffix of `FunctionStmt` and
`SubroutineStmt` (including `BIND(C)`) and set them on the subprogram
symbol.

Create a test for this using `test_symbol.sh`. It compiles with
`-funparse-with-symbols` and compares the output with the symbols in
comments in the input.

Change `test_errors.sh` to be similar to `test_symbol.sh`: check usage
and allow `F18` environment variable to override the path to the
compiler.

Original-commit: flang-compiler/f18@384828a22f53d828a3140640ca89f5819ada394d
Reviewed-on: https://github.com/flang-compiler/f18/pull/120
Tree-same-pre-rewrite: false

6 years ago[flang] Merge pull request flang-compiler/f18#119 from flang-compiler/pmk1
Peter Klausler [Wed, 11 Jul 2018 21:50:59 +0000 (14:50 -0700)]
[flang] Merge pull request flang-compiler/f18#119 from flang-compiler/pmk1

Use braces in `auto` initializers in lib/{parser,common,evaluate}

Original-commit: flang-compiler/f18@1aeba0c214b3a6388de630345eb5164749be598d
Reviewed-on: https://github.com/flang-compiler/f18/pull/119

6 years ago[flang] Documentation
peter klausler [Wed, 11 Jul 2018 17:26:53 +0000 (10:26 -0700)]
[flang] Documentation

Original-commit: flang-compiler/f18@d2855c6474b273987492f7f879c0f7a674f35c8f
Reviewed-on: https://github.com/flang-compiler/f18/pull/119

6 years ago[flang] merge and reformat
peter klausler [Wed, 11 Jul 2018 17:22:05 +0000 (10:22 -0700)]
[flang] merge and reformat

Original-commit: flang-compiler/f18@2e3d67aa79e1e7e0af58e1d21bb500a987338c03
Reviewed-on: https://github.com/flang-compiler/f18/pull/119
Tree-same-pre-rewrite: false

6 years ago[flang] correct typo in unparse.cc found in test
peter klausler [Wed, 11 Jul 2018 15:35:18 +0000 (08:35 -0700)]
[flang] correct typo in unparse.cc found in test

Original-commit: flang-compiler/f18@1aa60cccc4f0a56802551d2ecae8eba4f5ed668b
Reviewed-on: https://github.com/flang-compiler/f18/pull/119
Tree-same-pre-rewrite: false

6 years ago[flang] Use braces for auto initialization in lib/common and lib/evaluate
peter klausler [Wed, 11 Jul 2018 00:11:12 +0000 (17:11 -0700)]
[flang] Use braces for auto initialization in lib/common and lib/evaluate

Original-commit: flang-compiler/f18@b0d1dd434bbcd55613d2f0b67863905baa8f818b
Reviewed-on: https://github.com/flang-compiler/f18/pull/119
Tree-same-pre-rewrite: false

6 years ago[flang] Use braces in auto initializers.
peter klausler [Wed, 11 Jul 2018 00:09:07 +0000 (17:09 -0700)]
[flang] Use braces in auto initializers.

Original-commit: flang-compiler/f18@b68fdff537abc5402751d2f2842ff6d191f4d1fe
Reviewed-on: https://github.com/flang-compiler/f18/pull/119
Tree-same-pre-rewrite: false

6 years ago[flang] Merge pull request flang-compiler/f18#118 from flang-compiler/pmk2
Peter Klausler [Wed, 11 Jul 2018 17:18:49 +0000 (10:18 -0700)]
[flang] Merge pull request flang-compiler/f18#118 from flang-compiler/pmk2

Better error recovery in the face of input that's not Fortran at all

Original-commit: flang-compiler/f18@7edf728444614f0eeda94c6b6dddd407a0cf380b
Reviewed-on: https://github.com/flang-compiler/f18/pull/118

6 years ago[flang] Better error recovery (for a case from Tim) and fix a problem where context...
peter klausler [Tue, 10 Jul 2018 23:09:21 +0000 (16:09 -0700)]
[flang] Better error recovery (for a case from Tim) and fix a problem where context is lost.

Original-commit: flang-compiler/f18@522822fd5a44aee41998e25f0691e44cbaaa202c
Reviewed-on: https://github.com/flang-compiler/f18/pull/118

6 years ago[flang] Merge pull request flang-compiler/f18#117 from flang-compiler/pmk1
Peter Klausler [Tue, 10 Jul 2018 17:58:34 +0000 (10:58 -0700)]
[flang] Merge pull request flang-compiler/f18#117 from flang-compiler/pmk1

Variables

Original-commit: flang-compiler/f18@d38c14ef24b2785534f1b79d885a444cb64e978a
Reviewed-on: https://github.com/flang-compiler/f18/pull/117

6 years ago[flang] Extend documentation
peter klausler [Tue, 10 Jul 2018 17:56:55 +0000 (10:56 -0700)]
[flang] Extend documentation

Original-commit: flang-compiler/f18@ac375a00ba871cc11244c5e111b42e7807648a14
Reviewed-on: https://github.com/flang-compiler/f18/pull/117

6 years ago[flang] Address review comments
peter klausler [Tue, 10 Jul 2018 17:18:34 +0000 (10:18 -0700)]
[flang] Address review comments

Original-commit: flang-compiler/f18@9e59b9b79d690e0293c61a889da28cbd42ac5194
Reviewed-on: https://github.com/flang-compiler/f18/pull/117
Tree-same-pre-rewrite: false

6 years ago[flang] Resolve build issues with older compilers.
peter klausler [Mon, 9 Jul 2018 23:23:12 +0000 (16:23 -0700)]
[flang] Resolve build issues with older compilers.

Original-commit: flang-compiler/f18@d8723284d3750e05fbf6290d99faecd5cd8a774e
Reviewed-on: https://github.com/flang-compiler/f18/pull/117
Tree-same-pre-rewrite: false

6 years ago[flang] Refine variable structure definitions, add references to Standard.
peter klausler [Mon, 9 Jul 2018 19:46:51 +0000 (12:46 -0700)]
[flang] Refine variable structure definitions, add references to Standard.

Original-commit: flang-compiler/f18@dbc6d45e02ded14d01ac856857e3e45b4cc0aa1a
Reviewed-on: https://github.com/flang-compiler/f18/pull/117
Tree-same-pre-rewrite: false

6 years ago[flang] Start cleaning up for merging.
peter klausler [Fri, 6 Jul 2018 23:59:05 +0000 (16:59 -0700)]
[flang] Start cleaning up for merging.

Original-commit: flang-compiler/f18@7355bd5b4238a5fe57da8c1446a20bb0caf26fc7
Reviewed-on: https://github.com/flang-compiler/f18/pull/117
Tree-same-pre-rewrite: false

6 years ago[flang] Use Indirection. Get variables to work in int expressions.
peter klausler [Fri, 6 Jul 2018 22:12:33 +0000 (15:12 -0700)]
[flang] Use Indirection.  Get variables to work in int expressions.

Original-commit: flang-compiler/f18@1000717da820d87b330719034281a69eaf37bb89
Reviewed-on: https://github.com/flang-compiler/f18/pull/117
Tree-same-pre-rewrite: false

6 years ago[flang] More abstraction in expressions.
peter klausler [Thu, 5 Jul 2018 21:19:19 +0000 (14:19 -0700)]
[flang] More abstraction in expressions.

Original-commit: flang-compiler/f18@2dc425acf58e9c4a836d6cb73b436b0059a5309f
Reviewed-on: https://github.com/flang-compiler/f18/pull/117
Tree-same-pre-rewrite: false

6 years ago[flang] tweaks
peter klausler [Thu, 5 Jul 2018 17:47:01 +0000 (10:47 -0700)]
[flang] tweaks

Original-commit: flang-compiler/f18@624c1d2ec8539ae96f00c99ca90c56a0d7e3d266
Reviewed-on: https://github.com/flang-compiler/f18/pull/117
Tree-same-pre-rewrite: false

6 years ago[flang] clean up dumping code
peter klausler [Thu, 5 Jul 2018 16:39:39 +0000 (09:39 -0700)]
[flang] clean up dumping code

Original-commit: flang-compiler/f18@29698883601984a16c48e4b5b3a1b314930ad47a
Reviewed-on: https://github.com/flang-compiler/f18/pull/117
Tree-same-pre-rewrite: false

6 years ago[flang] Fix issue flang-compiler/f18#113.
peter klausler [Tue, 3 Jul 2018 23:17:52 +0000 (16:17 -0700)]
[flang] Fix issue flang-compiler/f18#113.

Original-commit: flang-compiler/f18@835e51b6e6e4030a26398f4c0e550d7baad13aa9
Reviewed-on: https://github.com/flang-compiler/f18/pull/117
Tree-same-pre-rewrite: false

6 years ago[flang] work on variables and traversal
peter klausler [Tue, 3 Jul 2018 22:14:48 +0000 (15:14 -0700)]
[flang] work on variables and traversal

Original-commit: flang-compiler/f18@432779b2218c500a18dec7f1018270bf150be0cb
Reviewed-on: https://github.com/flang-compiler/f18/pull/117
Tree-same-pre-rewrite: false

6 years ago[flang] Commit work in progress to branch for f18 repository move.
peter klausler [Tue, 26 Jun 2018 22:18:53 +0000 (15:18 -0700)]
[flang] Commit work in progress to branch for f18 repository move.

Original-commit: flang-compiler/f18@e0db6903c74b5cadfff461da9f4e51b59e165ba0
Reviewed-on: https://github.com/flang-compiler/f18/pull/117
Tree-same-pre-rewrite: false

6 years ago[flang] Merge pull request flang-compiler/f18#116 from flang-compiler/tsk8
Tim Keith [Mon, 9 Jul 2018 23:02:23 +0000 (16:02 -0700)]
[flang] Merge pull request flang-compiler/f18#116 from flang-compiler/tsk8

Fix bug recognizing derived type constructor call

Original-commit: flang-compiler/f18@e52910514495abf55094defb6668447e178e1c84
Reviewed-on: https://github.com/flang-compiler/f18/pull/116

6 years ago[flang] Fix bug recognizing derived type constructor call
Tim Keith [Mon, 9 Jul 2018 22:25:49 +0000 (15:25 -0700)]
[flang] Fix bug recognizing derived type constructor call

A ProcedureDesignator is a derived type constructor call if the name
resolves to a derived type. We need to recognize it as such and not
report an error. It may be in another derived type so we have to call
FindSymbol() first to find the derived type.

Most of the diffs are due to `symbol` changing from a reference to a
pointer.

In this example we were reporting an error on the first `t1()` and
resolving the second as an external function call.
```
module m
  type :: t1
  end type
  type(t1) :: x = t1()
  type t2
    type(t1) :: y = t1()
  end type
end module
```

Original-commit: flang-compiler/f18@717b22ca2b9e7ade24454b90b980f8c825fe4b12
Reviewed-on: https://github.com/flang-compiler/f18/pull/116

6 years ago[flang] Merge pull request flang-compiler/f18#114 from flang-compiler/tsk5
Tim Keith [Thu, 5 Jul 2018 21:47:48 +0000 (14:47 -0700)]
[flang] Merge pull request flang-compiler/f18#114 from flang-compiler/tsk5

Check consistency of generic interfaces.

Original-commit: flang-compiler/f18@16ed60240ab8a81f5a64cad2741899b9b53fe44e
Reviewed-on: https://github.com/flang-compiler/f18/pull/114

6 years ago[flang] Add missing copyright.
Tim Keith [Thu, 5 Jul 2018 17:36:18 +0000 (10:36 -0700)]
[flang] Add missing copyright.

Original-commit: flang-compiler/f18@cf7087b3816a3cc5421bb75c4bccf358ac7d2db6
Reviewed-on: https://github.com/flang-compiler/f18/pull/114

6 years ago[flang] Check consistency of generic interfaces.
Tim Keith [Thu, 5 Jul 2018 17:28:34 +0000 (10:28 -0700)]
[flang] Check consistency of generic interfaces.

The specific procedures in a generic interface must be all functions or
all subroutines. If there is a derived type with the same name they can
only be functions.

Original-commit: flang-compiler/f18@e02cef047a02585caba550da01dcf7f5e75942dd
Reviewed-on: https://github.com/flang-compiler/f18/pull/114
Tree-same-pre-rewrite: false

6 years ago[flang] Merge pull request flang-compiler/f18#112 from ThePortlandGroup/tsk5
Tim Keith [Tue, 26 Jun 2018 22:43:01 +0000 (15:43 -0700)]
[flang] Merge pull request flang-compiler/f18#112 from ThePortlandGroup/tsk5

Support unparse with symbol annotations.

Original-commit: flang-compiler/f18@fcca042a10b3908ffb72d8cf7ae86c71cffdfc6d
Reviewed-on: https://github.com/flang-compiler/f18/pull/112

6 years ago[flang] Add -funparse-with-symbols to enable new behavior
Tim Keith [Tue, 26 Jun 2018 22:40:52 +0000 (15:40 -0700)]
[flang] Add -funparse-with-symbols to enable new behavior

Original-commit: flang-compiler/f18@7ad44e7e33de7020a94378b8f98395e7d5edef51
Reviewed-on: https://github.com/flang-compiler/f18/pull/112

6 years ago[flang] Support unparse with symbol annotations.
Tim Keith [Tue, 26 Jun 2018 22:01:42 +0000 (15:01 -0700)]
[flang] Support unparse with symbol annotations.

When `-fdebug-dump-symbols` is supplied with `-funparse`, include symbol
information in comments in the Fortran output. This will be used for
testing to verify that correct symbols are defined and references in
the right place.

In `UnparseWithSymbols()`, walk the parse tree and collect symbol
definitions and references, organized by statement. When a symbol is
defined across several statement it is associated with the first.
The definition of implicitly defined symbols is associated with the
first reference.

To write out the symbol information, a new optional argument is added to
`Unparse()`: it is a function that is called immediately before each
statement is unparsed. We pass in a function that prints out the symbol
information collected for that statement.

Add `Symbol::GetType()` to make it easier to write the symbol types
and add `Symbol::SetType()` for uniformity.

Original-commit: flang-compiler/f18@2e827de4ad23d036fa3436382c8a878a991f11f5
Reviewed-on: https://github.com/flang-compiler/f18/pull/112
Tree-same-pre-rewrite: false

6 years ago[flang] Merge pull request flang-compiler/f18#111 from ThePortlandGroup/pmk-expr
Peter Klausler [Mon, 25 Jun 2018 16:32:14 +0000 (09:32 -0700)]
[flang] Merge pull request flang-compiler/f18#111 from ThePortlandGroup/pmk-expr

Expressions

Original-commit: flang-compiler/f18@802e18cb5ae3dae3d5f8d2e3bce0807cd362660e
Reviewed-on: https://github.com/flang-compiler/f18/pull/111

6 years ago[flang] Incorporate suggestions from code review.
peter klausler [Fri, 22 Jun 2018 23:44:23 +0000 (16:44 -0700)]
[flang] Incorporate suggestions from code review.

Original-commit: flang-compiler/f18@c66bd9ab15846afcaed129764b8c958f277e071f
Reviewed-on: https://github.com/flang-compiler/f18/pull/111

6 years ago[flang] Begin folding, with simple test, as sanity check on usability.
peter klausler [Fri, 22 Jun 2018 21:51:15 +0000 (14:51 -0700)]
[flang] Begin folding, with simple test, as sanity check on usability.

Original-commit: flang-compiler/f18@3839c65cd5ba3a7d2ab84bd48a371659a249b383
Reviewed-on: https://github.com/flang-compiler/f18/pull/111
Tree-same-pre-rewrite: false

6 years ago[flang] clean up for push
peter klausler [Fri, 22 Jun 2018 20:40:56 +0000 (13:40 -0700)]
[flang] clean up for push

Original-commit: flang-compiler/f18@8b5bbcedba41828d24e01251b06789d3eef4ebf8
Reviewed-on: https://github.com/flang-compiler/f18/pull/111
Tree-same-pre-rewrite: false

6 years ago[flang] Prepare for check-in
peter klausler [Fri, 22 Jun 2018 20:00:13 +0000 (13:00 -0700)]
[flang] Prepare for check-in

Original-commit: flang-compiler/f18@2f5b2d5f40106a61bee6b726d2d7915bb891fe85
Reviewed-on: https://github.com/flang-compiler/f18/pull/111
Tree-same-pre-rewrite: false

6 years ago[flang] Operator overloads for expression construction.
peter klausler [Fri, 22 Jun 2018 19:22:50 +0000 (12:22 -0700)]
[flang] Operator overloads for expression construction.

Original-commit: flang-compiler/f18@a4d3a736cf3d0c90fd5e26fb25b3adbc4530179a
Reviewed-on: https://github.com/flang-compiler/f18/pull/111
Tree-same-pre-rewrite: false

6 years ago[flang] clean up clang warnings from master
peter klausler [Fri, 22 Jun 2018 18:22:50 +0000 (11:22 -0700)]
[flang] clean up clang warnings from master

Original-commit: flang-compiler/f18@1c9aa95f8ddb2bd2b8366f84bd4cf7144de4c279
Reviewed-on: https://github.com/flang-compiler/f18/pull/111
Tree-same-pre-rewrite: false

6 years ago[flang] More refinement, use const on subexpressions.
peter klausler [Fri, 22 Jun 2018 18:02:54 +0000 (11:02 -0700)]
[flang] More refinement, use const on subexpressions.

Original-commit: flang-compiler/f18@f484325c61fd5d7d4aec1fdbbf24fb54a97be907
Reviewed-on: https://github.com/flang-compiler/f18/pull/111
Tree-same-pre-rewrite: false

6 years ago[flang] Simplification
peter klausler [Thu, 21 Jun 2018 22:35:25 +0000 (15:35 -0700)]
[flang] Simplification

Original-commit: flang-compiler/f18@a50ce6e499f484deeb1296dbb1139a9b8ca91b4a
Reviewed-on: https://github.com/flang-compiler/f18/pull/111
Tree-same-pre-rewrite: false

6 years ago[flang] fix builds, all now clear
peter klausler [Thu, 21 Jun 2018 20:28:31 +0000 (13:28 -0700)]
[flang] fix builds, all now clear

Original-commit: flang-compiler/f18@7c32a531a0cfe6a766fe0c2faa2b7e26ee957a14
Reviewed-on: https://github.com/flang-compiler/f18/pull/111
Tree-same-pre-rewrite: false

6 years ago[flang] Dump complex expressions
peter klausler [Thu, 21 Jun 2018 19:54:46 +0000 (12:54 -0700)]
[flang] Dump complex expressions

Original-commit: flang-compiler/f18@da25b870d32bebc2b3055ede771efaf6701e8a3f
Reviewed-on: https://github.com/flang-compiler/f18/pull/111
Tree-same-pre-rewrite: false

6 years ago[flang] More dumping code
peter klausler [Thu, 21 Jun 2018 19:47:28 +0000 (12:47 -0700)]
[flang] More dumping code

Original-commit: flang-compiler/f18@43d147144a843956ab37ae4714902795c652e347
Reviewed-on: https://github.com/flang-compiler/f18/pull/111
Tree-same-pre-rewrite: false

6 years ago[flang] Use unique_ptr for operands. Refactor comparisons.
peter klausler [Thu, 21 Jun 2018 18:03:00 +0000 (11:03 -0700)]
[flang] Use unique_ptr for operands.  Refactor comparisons.

Original-commit: flang-compiler/f18@92e154e76eeac6ea91c62cdc0081fb35258f8c78
Reviewed-on: https://github.com/flang-compiler/f18/pull/111
Tree-same-pre-rewrite: false

6 years ago[flang] Expression formatting
peter klausler [Wed, 20 Jun 2018 23:50:27 +0000 (16:50 -0700)]
[flang] Expression formatting

Original-commit: flang-compiler/f18@3d0977a57e32460ac0cf808a7e4b5bcbdb3d30ba
Reviewed-on: https://github.com/flang-compiler/f18/pull/111
Tree-same-pre-rewrite: false

6 years ago[flang] Change memcpy to memmove for overlap case.
peter klausler [Wed, 20 Jun 2018 22:12:13 +0000 (15:12 -0700)]
[flang] Change memcpy to memmove for overlap case.

Original-commit: flang-compiler/f18@cb400284e48a486922ee4420f02448eb68966fcf
Reviewed-on: https://github.com/flang-compiler/f18/pull/111
Tree-same-pre-rewrite: false

6 years ago[flang] Numeric constant formatting and tests.
peter klausler [Wed, 20 Jun 2018 22:10:34 +0000 (15:10 -0700)]
[flang] Numeric constant formatting and tests.

Original-commit: flang-compiler/f18@ade64420201c45d8082c65ba21e6e7d161605300
Reviewed-on: https://github.com/flang-compiler/f18/pull/111
Tree-same-pre-rewrite: false

6 years ago[flang] Character LEN, operator overloadings
peter klausler [Wed, 20 Jun 2018 18:55:10 +0000 (11:55 -0700)]
[flang] Character LEN, operator overloadings

Original-commit: flang-compiler/f18@08c32de24cae7ea9091f665337c1c2386ec87a32
Reviewed-on: https://github.com/flang-compiler/f18/pull/111
Tree-same-pre-rewrite: false

6 years ago[flang] Finish first cut at expression.h.
peter klausler [Wed, 20 Jun 2018 17:53:49 +0000 (10:53 -0700)]
[flang] Finish first cut at expression.h.

Original-commit: flang-compiler/f18@07142e7fad2b8c672df7549caec8be0d1c0d3856
Reviewed-on: https://github.com/flang-compiler/f18/pull/111
Tree-same-pre-rewrite: false

6 years ago[flang] Expression work
peter klausler [Tue, 19 Jun 2018 23:26:48 +0000 (16:26 -0700)]
[flang] Expression work

Original-commit: flang-compiler/f18@b60c84fff491d19402f95f825b4be42f239ac2a9
Reviewed-on: https://github.com/flang-compiler/f18/pull/111
Tree-same-pre-rewrite: false

6 years ago[flang] reformat c++
peter klausler [Tue, 19 Jun 2018 21:17:14 +0000 (14:17 -0700)]
[flang] reformat c++

Original-commit: flang-compiler/f18@6c5c9b316542b558d1d4e3883c92e172f374e230
Reviewed-on: https://github.com/flang-compiler/f18/pull/111
Tree-same-pre-rewrite: false

6 years ago[flang] first cut at expressions
peter klausler [Tue, 19 Jun 2018 21:16:01 +0000 (14:16 -0700)]
[flang] first cut at expressions

Original-commit: flang-compiler/f18@b06c5486e4d80e017a9c697c79ac588a88498547
Reviewed-on: https://github.com/flang-compiler/f18/pull/111
Tree-same-pre-rewrite: false

6 years ago[flang] begin expression representation
peter klausler [Mon, 18 Jun 2018 19:09:56 +0000 (12:09 -0700)]
[flang] begin expression representation

Original-commit: flang-compiler/f18@627c057d5c8392914eb186e8f6dacab40b5a6666
Reviewed-on: https://github.com/flang-compiler/f18/pull/111
Tree-same-pre-rewrite: false

6 years ago[flang] Documentation
peter klausler [Mon, 18 Jun 2018 18:26:06 +0000 (11:26 -0700)]
[flang] Documentation

Original-commit: flang-compiler/f18@27f6927053fa685b9366647fa02b595ffd830441
Reviewed-on: https://github.com/flang-compiler/f18/pull/111
Tree-same-pre-rewrite: false

6 years ago[flang] Merge pull request flang-compiler/f18#110 from ThePortlandGroup/tsk1
Tim Keith [Fri, 22 Jun 2018 21:45:41 +0000 (14:45 -0700)]
[flang] Merge pull request flang-compiler/f18#110 from ThePortlandGroup/tsk1

Fix problems in PR 109 when compiling with clang.

Original-commit: flang-compiler/f18@f21c334589e580c1c32aa3b8abad000636283e8f
Reviewed-on: https://github.com/flang-compiler/f18/pull/110

6 years ago[flang] Fix problems in PR 109 when compiling with clang.
Tim Keith [Fri, 22 Jun 2018 21:08:04 +0000 (14:08 -0700)]
[flang] Fix problems in PR 109 when compiling with clang.

This gets the code base back to compiling cleanly with clang after
pull request 109.

There were two overloadings of `Post(const parser::DeclarationTypeSpec::Type &)`.
The one in DeclarationVisitor needed to call the one in DeclTypeSpecVisitor.
This was fixed by introducing a new function, SetDerivedDeclTypeSpec, to do
the equivalent thing.

Original-commit: flang-compiler/f18@81e447bf4ec076f8fa823c0c61c9dd72e1f62fe4
Reviewed-on: https://github.com/flang-compiler/f18/pull/110

6 years ago[flang] Merge pull request flang-compiler/f18#109 from ThePortlandGroup/tsk5
Tim Keith [Fri, 22 Jun 2018 17:29:28 +0000 (10:29 -0700)]
[flang] Merge pull request flang-compiler/f18#109 from ThePortlandGroup/tsk5

Name resolution for derived types.

Original-commit: flang-compiler/f18@5317d4f30ae926ee4f839d3afab68363d1d9c5c9
Reviewed-on: https://github.com/flang-compiler/f18/pull/109

6 years ago[flang] Name resolution for derived types.
Tim Keith [Fri, 22 Jun 2018 15:21:19 +0000 (08:21 -0700)]
[flang] Name resolution for derived types.

This consists of:
- a new kind of symbols to represent them with DerivedTypeDetails
- creating symbols for derived types when they are declared
- creating a new kind of scope for the type to hold component symbols
- resolving entity declarations of objects of derived type
- resolving references to objects of derived type and to components
- handling derived types with same name as generic

Type parameters are not yet implemented.

Refactor DeclTypeSpec to be a value class wrapping an IntrinsicTypeSpec
or a DerivedTypeSpec (or neither in the TypeStar and ClassStar cases).
Store DerivedTypeSpec objects in a new structure the current scope
MakeDerivedTypeSpec so that DeclTypeSpec can just contain a pointer to
them, as it currently does for intrinsic types.

In GenericDetails, add derivedType field to handle case where generic
and derived type have the same name. The generic is in the scope and the
derived type is referenced from the generic, similar to the case where a
generic and specific have the same name. When one of these names is
mis-recognized, we sometimes have to fix up the 'occurrences' lists
of the symbols.

Assign implicit types as soon as an entity is encountered that requires
one. Otherwise implicit derived types won't work. When we see 'x%y' we
have to know the type of x in order to resolve y. Add an Implicit flag
to mark symbols that were implicitly typed

For symbols that introduce a new scope, include a pointer back to that
scope.

Add CurrNonTypeScope() for the times when we want the current scope but
ignoring derived type scopes. For example, that happens when looking for
types or parameters, or creating implicit symbols.

Original-commit: flang-compiler/f18@9bd16da020b64b78ed3928e0244765cd2e2d8068
Reviewed-on: https://github.com/flang-compiler/f18/pull/109

6 years ago[flang] Refactor DeclTypeSpec and DerivedTypeSpec classes.
Tim Keith [Thu, 14 Jun 2018 22:34:57 +0000 (15:34 -0700)]
[flang] Refactor DeclTypeSpec and DerivedTypeSpec classes.

Make DerivedTypeSpec a simple wrapper around the name of the type.
Leave out type parameter values until we are ready to resolve them
as well.

Change DeclTypeSpec to be an old-fashioned union with an enum to
indicate what is in it. std::variant doesn't work well here because
we wanted the enum visible in the class' API and there is not a
1-to-1 mapping between enumerators and data stored.

Original-commit: flang-compiler/f18@03bdeef790375ea7dbac6abf1118ec743c55a1b6
Reviewed-on: https://github.com/flang-compiler/f18/pull/109
Tree-same-pre-rewrite: false

6 years ago[flang] Merge pull request flang-compiler/f18#107 from ThePortlandGroup/tsk2
Tim Keith [Wed, 20 Jun 2018 17:13:43 +0000 (10:13 -0700)]
[flang] Merge pull request flang-compiler/f18#107 from ThePortlandGroup/tsk2

Change how memory for Symbol instances is managed.

Original-commit: flang-compiler/f18@ccf6aeac622038c5d2a3151d4566aa2536e9aea2
Reviewed-on: https://github.com/flang-compiler/f18/pull/107

6 years ago[flang] Change how memory for Symbol instances is managed.
Tim Keith [Tue, 19 Jun 2018 23:06:41 +0000 (16:06 -0700)]
[flang] Change how memory for Symbol instances is managed.

With this change, all instances Symbol are stored in class Symbols.
Scope.symbols_, which used to own the symbol memory, now maps names to
Symbol* instead. This causes a bunch of reference-to-pointer changes
because of the change in type of key-value pairs. It also requires a
default constructor for Symbol, which means owner_ can't be a reference.

Symbols manages Symbol instances by allocating a block of them at a time
and returning the next one when needed. They are never freed.

The reason for the change is that there are a few cases where we need
to have a two symbols with the same name, so they can't both live in
the map in Scope. Those are:
1. When there is an erroneous redeclaration of a name we may delete the
   first symbol and replace it with a new one. If we have saved a pointer
   to the first one it is now dangling. This can be seen by running
   `f18 -fdebug-dump-symbols -fparse-only test/semantics/resolve19.f90`
   under valgrind. Subroutine s is declared twice: each results in a
   scope that contains a pointer back to the symbol for the subroutine.
   After the second symbol for s is created the first is gone so the
   pointer in the scope is invalid.
2. A generic and one of its specifics can have the same name. We currently
   handle that by moving the symbol for the specific into a unique_ptr
   in the generic. So in that case the symbol is owned by another symbol
   instead of by the scope. It is simpler if we only have to deal with
   moving the raw pointer around.
3. A generic and a derived type can have the same name. This case isn't
   handled yet, but it can be done like flang-compiler/f18#2 above. It's more complicated
   because the derived type and the generic can be declared in either
   order.

Original-commit: flang-compiler/f18@55a68cf0235c8a3ac855de7dc0e2b08690866be0
Reviewed-on: https://github.com/flang-compiler/f18/pull/107

6 years ago[flang] Fix bug in adding symbols to parse tree.
Tim Keith [Tue, 19 Jun 2018 21:59:41 +0000 (14:59 -0700)]
[flang] Fix bug in adding symbols to parse tree.

We were collecting symbols in a map of SourceName to Symbol*.
This is wrong because sometimes different occurrences of a name
map to different symbols (e.g. in different scopes).
SourceName::begin() is unique for each occurrence so use that
as the map key instead.

The problem can be reproduced by running:
`f18 -fdebug-resolve-names -fparse-only -fdebug-dump-parse-tree`
on the following source. The two symbols 'i' should have different
types and they were both coming out as INTEGER because they both
pointed to the first symbol for 'i'.

```
module m
  integer :: i
contains
  subroutine s
    real :: i
  end
end
```

Original-commit: flang-compiler/f18@a165c717ff20d3ccca334b91fa538f54b54071cf
Reviewed-on: https://github.com/flang-compiler/f18/pull/107
Tree-same-pre-rewrite: false

6 years ago[flang] Merge pull request flang-compiler/f18#106 from ThePortlandGroup/pmk-value
Peter Klausler [Mon, 18 Jun 2018 19:10:35 +0000 (12:10 -0700)]
[flang] Merge pull request flang-compiler/f18#106 from ThePortlandGroup/pmk-value

Rearrange some facilities into a new lib/common.

Original-commit: flang-compiler/f18@12477c3c3090b6cd2db0fa247aab073808a94511
Reviewed-on: https://github.com/flang-compiler/f18/pull/106

6 years ago[flang] Rearrange some facilities into a new lib/common.
peter klausler [Mon, 18 Jun 2018 18:03:43 +0000 (11:03 -0700)]
[flang] Rearrange some facilities into a new lib/common.

Original-commit: flang-compiler/f18@279af1e817b1266dd57689e462272f8e29496798
Reviewed-on: https://github.com/flang-compiler/f18/pull/106

6 years ago[flang] Merge pull request flang-compiler/f18#105 from ThePortlandGroup/tsk2
Tim Keith [Fri, 15 Jun 2018 22:40:33 +0000 (15:40 -0700)]
[flang] Merge pull request flang-compiler/f18#105 from ThePortlandGroup/tsk2

Add name resolution tests

Original-commit: flang-compiler/f18@edf182d458cb5a362369fb0b71a3e98282439559
Reviewed-on: https://github.com/flang-compiler/f18/pull/105

6 years ago[flang] Add name resolution tests
Tim Keith [Fri, 15 Jun 2018 21:54:34 +0000 (14:54 -0700)]
[flang] Add name resolution tests

The Fortran source files in test/semantics all contain expected
errors in comments. The script test_errors.sh compiles a file with
'f18 -fdebug-resolve-names -fparse-only' and compares the actual
errors produced against the expected ones.

The change to resolve15.f90 is necessary because test_errors.sh can't
handle two expected errors for the same source line.

A useful command to run these is 'ctest -R f90 --output-on-failure'.
-R means only run tests with f90 in the name
--output-on-failure prints the output of test_errors.sh when a test
fails, showing the expected and actual messages that differ.

Original-commit: flang-compiler/f18@df18ee7bc95628503b37648d98c5ae25bc74b227
Reviewed-on: https://github.com/flang-compiler/f18/pull/105

6 years ago[flang] Merge pull request flang-compiler/f18#101 from ThePortlandGroup/pmk-evaluate
Peter Klausler [Fri, 15 Jun 2018 17:35:45 +0000 (10:35 -0700)]
[flang] Merge pull request flang-compiler/f18#101 from ThePortlandGroup/pmk-evaluate

Basic operation evaluation framework

Original-commit: flang-compiler/f18@e91fac085d347639d1ddc5e6baf8d9b6fc41f3f3
Reviewed-on: https://github.com/flang-compiler/f18/pull/101

6 years ago[flang] Test 64-bit reals too.
peter klausler [Fri, 15 Jun 2018 17:02:09 +0000 (10:02 -0700)]
[flang] Test 64-bit reals too.

Original-commit: flang-compiler/f18@67fd5514417b2c920be85e0919bf06b06a399e3c
Reviewed-on: https://github.com/flang-compiler/f18/pull/101

6 years ago[flang] Address review comments
peter klausler [Thu, 14 Jun 2018 20:43:02 +0000 (13:43 -0700)]
[flang] Address review comments

Original-commit: flang-compiler/f18@d96917c70130b12462d28189ded5e6243e8c854e
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] More rearrangement, and debug an edge case with Underflow flag.
peter klausler [Wed, 13 Jun 2018 23:08:12 +0000 (16:08 -0700)]
[flang] More rearrangement, and debug an edge case with Underflow flag.

Original-commit: flang-compiler/f18@57ef08433ebc1b174551dfaca0c57ba97a1d7806
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] Move member functions complex.h -> complex.cc
peter klausler [Wed, 13 Jun 2018 17:44:55 +0000 (10:44 -0700)]
[flang] Move member functions complex.h -> complex.cc

Original-commit: flang-compiler/f18@445333b13e212816f42b38c940b89e6a90708414
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] Remove work-around in resolve-names.cc.
peter klausler [Wed, 13 Jun 2018 17:36:56 +0000 (10:36 -0700)]
[flang] Remove work-around in resolve-names.cc.

Original-commit: flang-compiler/f18@5dc0e037f59f6e58d45d7f65ec52e7cd5525b78c
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] Cleaning up Real<> for review.
peter klausler [Wed, 13 Jun 2018 17:34:23 +0000 (10:34 -0700)]
[flang] Cleaning up Real<> for review.

Original-commit: flang-compiler/f18@a87f324a7fd9f5f2e6dcc80b537c90ff3eb49484
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] Prepare for review.
peter klausler [Wed, 13 Jun 2018 16:22:50 +0000 (09:22 -0700)]
[flang] Prepare for review.

Original-commit: flang-compiler/f18@266d25f630b459d1e20aa4dc9074732ad1fd07b5
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] Less exhaustive REAL testing by default.
peter klausler [Tue, 12 Jun 2018 22:45:52 +0000 (15:45 -0700)]
[flang] Less exhaustive REAL testing by default.

Original-commit: flang-compiler/f18@d61ac7da9bf719fdda81821aab8fb2b7503f5367
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] COMPLEX
peter klausler [Tue, 12 Jun 2018 22:14:18 +0000 (15:14 -0700)]
[flang] COMPLEX

Original-commit: flang-compiler/f18@452d602fbb5931e29f4e8450660705297c2672c5
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] LOGICAL
peter klausler [Tue, 12 Jun 2018 20:33:08 +0000 (13:33 -0700)]
[flang] LOGICAL

Original-commit: flang-compiler/f18@6ec49f6edc3fc2bc4475bd08b4d3f2769b6fc441
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] Revamp type.h, add LOGICAL
peter klausler [Tue, 12 Jun 2018 19:59:31 +0000 (12:59 -0700)]
[flang] Revamp type.h, add LOGICAL

Original-commit: flang-compiler/f18@f7d77887a2a3f6bf9991181abb09911dd75d8e20
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] All operations now work and match x86, all modes and flags.
peter klausler [Mon, 11 Jun 2018 23:01:54 +0000 (16:01 -0700)]
[flang] All operations now work and match x86, all modes and flags.

Original-commit: flang-compiler/f18@c69eef6524c086403e3f29c4a983514a9f2244bc
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] More real work. All ops, rounding modes, and flags good except for division.
peter klausler [Mon, 11 Jun 2018 18:35:53 +0000 (11:35 -0700)]
[flang] More real work.  All ops, rounding modes, and flags good except for division.

Original-commit: flang-compiler/f18@ea697295db84b64b1c13144e3b5eaef9a879e319
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] Check flag bits.
peter klausler [Fri, 8 Jun 2018 22:49:06 +0000 (15:49 -0700)]
[flang] Check flag bits.

Original-commit: flang-compiler/f18@b63e39aae7c4c1de2fbdca24aa096d594039e934
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] Multiplication, more tests.
peter klausler [Fri, 8 Jun 2018 22:18:03 +0000 (15:18 -0700)]
[flang] Multiplication, more tests.

Original-commit: flang-compiler/f18@e7ef16d2166cc946d59dd072754f8a347290e00a
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] Refactor rounding code.
peter klausler [Fri, 8 Jun 2018 17:58:58 +0000 (10:58 -0700)]
[flang] Refactor rounding code.

Original-commit: flang-compiler/f18@8ef2418791e62d8a90802a2e6754975a52412479
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] Get real add/subtract working and tested.
peter klausler [Fri, 8 Jun 2018 17:24:15 +0000 (10:24 -0700)]
[flang] Get real add/subtract working and tested.

Original-commit: flang-compiler/f18@c1b4389638d83cf9be712afc43cddc5d57e4dd48
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] start negative number tests
peter klausler [Wed, 6 Jun 2018 18:48:00 +0000 (11:48 -0700)]
[flang] start negative number tests

Original-commit: flang-compiler/f18@1b52ec8d3bc01640a46b2561918c5bb608d64d80
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] Get back to passing all tests.
peter klausler [Wed, 6 Jun 2018 18:26:00 +0000 (11:26 -0700)]
[flang] Get back to passing all tests.

Original-commit: flang-compiler/f18@d08dc86ede2a6a3c2b14b03f1cc8be9e924c0aff
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] Use EnumSet<> for real flags
peter klausler [Wed, 6 Jun 2018 18:11:35 +0000 (11:11 -0700)]
[flang] Use EnumSet<> for real flags

Original-commit: flang-compiler/f18@a61f193036e6ea33e5e28bc23ceeb2c13ee14ff2
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] some real debugging
peter klausler [Tue, 5 Jun 2018 23:55:31 +0000 (16:55 -0700)]
[flang] some real debugging

Original-commit: flang-compiler/f18@9653814ed3623f2abf592242b6d914bddc8766c7
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] begin testing reals
peter klausler [Tue, 5 Jun 2018 23:29:26 +0000 (16:29 -0700)]
[flang] begin testing reals

Original-commit: flang-compiler/f18@9d261b594bbf2a6dcec833239635599b28007e4d
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] Convert REAL code to use IEEE encodings.
peter klausler [Tue, 5 Jun 2018 20:55:56 +0000 (13:55 -0700)]
[flang] Convert REAL code to use IEEE encodings.

Original-commit: flang-compiler/f18@b36e50f46566cbb6975fc8c9325a003ef6abfcd9
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] real work
peter klausler [Mon, 4 Jun 2018 23:22:58 +0000 (16:22 -0700)]
[flang] real work

Original-commit: flang-compiler/f18@030347a906eda6384fd4d69dfe7d8e638aee9a2d
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] More work on reals.
peter klausler [Mon, 4 Jun 2018 22:56:40 +0000 (15:56 -0700)]
[flang] More work on reals.

Original-commit: flang-compiler/f18@3ba634a2140f413f1e7ecb1ac570aa6fc73f0cd7
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] more work on reals
peter klausler [Mon, 4 Jun 2018 16:49:47 +0000 (09:49 -0700)]
[flang] more work on reals

Original-commit: flang-compiler/f18@3afe85bf153e39e20fd2562c605167caf48e7cff
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] begin real.h
peter klausler [Fri, 1 Jun 2018 22:30:31 +0000 (15:30 -0700)]
[flang] begin real.h

Original-commit: flang-compiler/f18@b0f0cd896161d769efc3f499cd3ae1359c82953a
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] bugfixing from clang build
peter klausler [Fri, 1 Jun 2018 19:55:32 +0000 (12:55 -0700)]
[flang] bugfixing from clang build

Original-commit: flang-compiler/f18@a05e108288065ebea3976922fb511e8c1851bd76
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] Reading numbers from strings.
peter klausler [Fri, 1 Jun 2018 19:37:23 +0000 (12:37 -0700)]
[flang] Reading numbers from strings.

Original-commit: flang-compiler/f18@8cbadfe7778a400756bc34dcbb5fe39334a742f8
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false

6 years ago[flang] Template specializations and more automatic configuration
peter klausler [Fri, 1 Jun 2018 18:48:31 +0000 (11:48 -0700)]
[flang] Template specializations and more automatic configuration

Original-commit: flang-compiler/f18@a230a539076bd57f64f1d2fd63852941453c4cda
Reviewed-on: https://github.com/flang-compiler/f18/pull/101
Tree-same-pre-rewrite: false