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.
Details
Details
- Reviewers
klausler tskeith - Commits
- rG5795a81cbab8: [flang] Fix "EQ" comparison of arrays
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
flang/lib/Evaluate/shape.cpp | ||
---|---|---|
698 | Might be more readable if restructured. Two possible ways: for (int j{0}; j < n; ++j) { auto leftDim{...}, rightDim{...}; if (!leftDim || !rightDim) { return false; } if (*leftDim != *rightDim) { Say(...); return false; } } or for (int j{0}; j < n; ++j) { if (auto leftDim{...}) { if (auto rightDim{...}) { if (*leftDim == *rightDim) { continue; } Say(...); } } return false; } |
flang/lib/Evaluate/shape.cpp | ||
---|---|---|
698 | Thanks for the suggestions. I like the first one. I'll rework the code. |
Might be more readable if restructured. Two possible ways:
for (int j{0}; j < n; ++j) {
}
or
for (int j{0}; j < n; ++j) {
}