forked from OSchip/llvm-project
[flang][runtime] Fix runtime CSHIFT of rank>1 array case of negative shift count
The calculation of the source index was incorrect when a CSHIFT shift count value is negative, for the implementation of CSHIFT for arrays with rank >= 2. (The vector CSHIFT is fine.) Differential Revision: https://reviews.llvm.org/D127424
This commit is contained in:
parent
6bc2ad235a
commit
bd577afe8f
|
@ -167,7 +167,7 @@ void RTNAME(Cshift)(Descriptor &result, const Descriptor &source,
|
|||
}
|
||||
SubscriptValue &sourceDim{sourceAt[dim - 1]};
|
||||
sourceDim = dimLB + shiftCount % dimExtent;
|
||||
if (shiftCount < 0) {
|
||||
if (sourceDim < dimLB) {
|
||||
sourceDim += dimExtent;
|
||||
}
|
||||
for (resDim = 1; resDim <= dimExtent; ++resDim) {
|
||||
|
|
Loading…
Reference in New Issue