llvm-project/flang/test
Peter Steinfeld 8989268dae [flang] Allow KIND type parameters to be used as LEN parameters of components
When producing the runtime type information for a component of a derived type
that had a LEN type parameter, we were not allowing a KIND parameter of the
derived type.  This was causing one of the NAG correctness tests to fail
(.../hibiya/d5.f90).

I added a test to our own test suite to check for this.

Also, I fixed a typo in .../module/__fortran_type_info.f90.

I allowed KIND type parameters to be used for the declarations of components
that use LEN parameters by constant folding the value of the LEN parameter.  To
make the constant folding work, I had to put the semantics::DerivedTypeSpec of
the associated derived type into the folding context.  To get this
semantics::DerivedTypeSpec, I changed the value of the semantics::Scope object
that was passed to DescribeComponent() to be the derived type scope rather than
the containing non-derived type scope.

This scope change, in turn, caused differences in the symbol table output that
is checked in typeinfo01.f90.  Most of these differences were in the order that
the symbols appeared in the dump.  But one of them changed one of the values
from "CHARACTER(2_8,1)" to "CHARACTER(1_8,1)".  I'm not sure if these changes
are significant.  Please verify that the results of this test are still valid.

Also, I wonder if there are other situations in this code where we should be
folding constants.  For example, what if the field of a component has a
component whose type is a PDT with a LEN type parameter, and the component's
declaration depends on the KIND type parameter of the current PDT.  Here's an
example:

  type string(stringkind)
    integer,kind :: stringkind
    character(stringkind) :: value
  end type string

  type outer(kindparam)
    integer,kind :: kindparam
    type(string(kindparam)) :: field
  end type outer

I don't understand the code or what it's trying to accomplish well enough to
figure out if such cases are correctly handled by my new code.

Differential Revision: https://reviews.llvm.org/D101482
2021-04-30 09:05:05 -07:00
..
Driver [flang][driver][Revert] Reverts f18 to allow options passed to -W 2021-04-22 11:47:48 -04:00
Evaluate [flang] Switch from %f18 to %flang_fc1 in a test 2021-04-23 15:10:07 +00:00
Fir [flang][fir] Add the pre-code gen rewrite pass and codegen ops. 2021-03-24 19:27:10 -07:00
Frontend [flang][driver] Remove `%flang-new` from the LIT configuration 2021-04-13 10:55:01 +00:00
Lower [flang] Update the regression tests to use the new driver when enabled 2021-04-15 08:52:23 +00:00
NonGtestUnit [flang] Run non-gtest unit tests with lit. 2020-07-24 14:49:39 +01:00
Parser [flang] Update the regression tests to use the new driver when enabled 2021-04-15 08:52:23 +00:00
Preprocessing [flang][driver] Update PP tests to use the new driver 2021-01-25 12:32:23 +00:00
Semantics [flang] Allow KIND type parameters to be used as LEN parameters of components 2021-04-30 09:05:05 -07:00
Unit [flang] unit test support for out-of-tree and in-tree using google tests framework 2020-06-15 22:09:56 +05:30
CMakeLists.txt [flang] Build intrinsic .mod files in include/flang 2021-03-15 08:03:02 -07:00
lit.cfg.py [flang][driver] Remove `%flang-new` from the LIT configuration 2021-04-13 10:55:01 +00:00
lit.site.cfg.py.in [flang][driver] Add the new flang compiler and frontend drivers 2020-09-11 10:55:54 +01:00