[flang] Fix crash in folding (#48437)
authorpeter klausler <pklausler@nvidia.com>
Tue, 15 Dec 2020 18:59:26 +0000 (10:59 -0800)
committerpeter klausler <pklausler@nvidia.com>
Wed, 16 Dec 2020 15:55:44 +0000 (07:55 -0800)
commit07751310580fa5b7b94b6efa85d7964af0f699a6
tree662074f32232705748a9dc60d46a03fb73a04bbd
parente2e86f4e77ec2fd79743f4d0e94689e9668600ad
[flang] Fix crash in folding (#48437)

Elemental intrinsic function folding was not taking the lower
bounds of constant array arguments into account; these lower bounds
can be distinct from 1 when named constants appear as arguments.

LLVM bugzilla #48437.

Differential Revision: https://reviews.llvm.org/D93321
flang/include/flang/Evaluate/constant.h
flang/lib/Evaluate/fold-implementation.h
flang/test/Evaluate/folding16.f90 [new file with mode: 0644]