llvm-project
6a7da2e3 - [flang] Fix source allocation to explicit length after deferred length object (#87785)

Commit
1 year ago
[flang] Fix source allocation to explicit length after deferred length object (#87785) Flang supports source allocation to allocatable or pointers with a non deferred length that do not match the source length. This documented at: https://github.com/llvm/llvm-project/blob/9708d0900311503aa4685d6810d8caf0412e15d7/flang/docs/Extensions.md?plain=1#L312 The current lowering code was bugged when such explicit length allocate object appeared after a deferred length object in the source allocation list: Since "lenParams" had been computed when generating allocation of the deferred length object, the call to genSetDeferredLengthParameters was not a no-op on when lowering the explicit length allocation, and the explicit length was overridden with the source length. The output of the program added in test was: ``` ZZheZZ ZZhelloZZ ZZhelloZZ ``` Instead of: ``` ZZheZZ ZZhelloZZ ZZhello ZZ ``` Skip genSetDeferredLengthParameters when the allocate object has non deferred length.
Author
Parents
Loading