[flang] Fix "EQ" comparison of arrays
authorPeter Steinfeld <psteinfeld@nvidia.com>
Fri, 13 Nov 2020 17:31:41 +0000 (09:31 -0800)
committerPeter Steinfeld <psteinfeld@nvidia.com>
Fri, 13 Nov 2020 23:18:13 +0000 (15:18 -0800)
commit5795a81cbab879e353299556157dd5fd42cc7857
tree22165182cce39b127f10a833b6d0f055bdc4a5be
parent52f05fb2c2c30d12238f7e4ce3f3a4f849c40972
[flang] Fix "EQ" comparison of arrays

When comparing arrays whose shapes do not conform, the contant folding
code ran into problems trying to get the value of an extent that did not
exist.  There were actually two problems.  First, the routine
"CheckConformance()" was returning "true" when the compiler was unable
to get the extent of an array.  Second, the function
"ApplyElementwise()" was calling "CheckConformance()" prior to folding
the elements of two arrays, but it was ignoring the return value.

Differential Revision: https://reviews.llvm.org/D91440
flang/lib/Evaluate/fold-implementation.h
flang/lib/Evaluate/shape.cpp
flang/test/Semantics/shape.f90 [new file with mode: 0644]