llvm-project/flang/test
Jean Perier 7c158e3e55 [flang] add evaluate::IsAllocatableDesignator helper
Previously, some semantic checks that are checking if an entity is an
allocatable were relying on the expression being a designator whose
last symbol has the allocatable attribute.

This is wrong since this was considering substrings and array sections of
allocatables as being allocatable. This is wrong (see NOTE 2 in
Fortran 2018 section 9.5.3.1).

Add evaluate::IsAllocatableDesignator to correctly test this.
Also add some semantic tests for ALLOCATED to test the newly added helper.
Note that ifort and nag are rejecting coindexed-named-object in
ALLOCATED (`allocated(coarray_scalar_alloc[2])`).
I think it is wrong given allocated argument is intent(in) as per
16.2.1 point 3.
So 15.5.2.6 point 4 regarding allocatable dummy is not violated (If the actual
argument is a coindexed object, the dummy argument shall have the INTENT (IN)
attribute.) and I think this is valid. gfortran accepts it.

The need for this helper was exposed in https://reviews.llvm.org/D122779.

Differential Revision: https://reviews.llvm.org/D122899

Co-authored-by: Peixin-Qiao <qiaopeixin@huawei.com>
2022-04-01 22:34:19 +02:00
..
Driver [flang][driver] Make --version and -version consistent with clang 2022-03-28 22:53:17 +02:00
Evaluate [flang] prevent undefined behavior in character MAXLOC folding 2022-03-29 09:34:09 +02:00
Examples [flang][Parser] Add a node for individual sections in sections construct 2022-03-18 21:55:35 +05:30
Fir [flang] Keep fully qualified !fir.heap type for fir.freemem op 2022-03-31 21:37:21 +02:00
Frontend [flang] Distinguish usage and portability warning messages 2022-03-08 17:24:52 -08:00
Lower Revert "[GreedPatternRewriter] Preprocess constants while building worklist when not processing top down" 2022-04-01 06:16:55 +00:00
NonGtestUnit Use lit_config.substitute instead of foo % lit_config.params everywhere 2022-03-16 09:57:41 +01:00
Parser [flang][Parser] Add a node for individual sections in sections construct 2022-03-18 21:55:35 +05:30
Preprocessing [flang] Distinguish usage and portability warning messages 2022-03-08 17:24:52 -08:00
Runtime Reland "[flang] GET_COMMAND_ARGUMENT runtime implementation" 2021-09-28 12:34:07 +00:00
Semantics [flang] add evaluate::IsAllocatableDesignator helper 2022-04-01 22:34:19 +02:00
Unit Use lit_config.substitute instead of foo % lit_config.params everywhere 2022-03-16 09:57:41 +01:00
CMakeLists.txt [flang][NFC] Add module lowering tests 2022-03-23 17:51:09 +01:00
lit.cfg.py [flang][driver] Add support for -S and implement -c/-emit-obj 2022-03-09 15:48:09 +00:00
lit.site.cfg.py.in Use lit_config.substitute instead of foo % lit_config.params everywhere 2022-03-16 09:57:41 +01:00