[PATCH] D95449: [flang] Fix problems with constant arrays with lower bounds that are not 1

Tim Keith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 29 07:21:22 PST 2021


tskeith accepted this revision.
tskeith added inline comments.


================
Comment at: flang/test/Evaluate/folding16.f90:6
 real, parameter :: b(-1:-1) = log(a)
+integer, parameter :: c(-1:1) = [33, 22, 11]
+integer, parameter :: d(1:3) = [33, 22, 11]
----------------
PeteSteinfeld wrote:
> PeteSteinfeld wrote:
> > tskeith wrote:
> > > I think you should be able to add this line to check the lower bound of `c`:
> > > `logical, parameter :: test_c = lbound(c, 1) == -1`
> > > 
> > > But when I tried that it failed. (It's possible I don't understand these folding tests.)
> > Good catch!  This test already has tests that test for the lower bound of arrays where the lower bound was negative, and the test was not reporting failure.  It turns out, though, that the test itself was erroneous because the test script only checks for constants that begin with "test_".  I will fix the test and the underlying bug.
> > 
> > I checked the other tests in this directory, and folding09.f90 has the same problem.  Stay tuned for another change.
> @tskeith, I've investigated this, and your test reveals two bugs, one with our tests and the other with constant folding of the intrinsic "lbound".  Neither is related to the other changes in this commit, though.
> 
> So my plan is to merge this change request (almost) as is and then fix these other two bugs in a separate change.  The one change I'll make is to the test folding16.f90 to enable the new tests I've added.  Let me know if you think that's a bad idea.
Sounds good to me.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D95449/new/

https://reviews.llvm.org/D95449



More information about the llvm-commits mailing list