[all-commits] [llvm/llvm-project] 6a7da2: [flang] Fix source allocation to explicit length a...

jeanPerier via All-commits all-commits at lists.llvm.org
Mon Apr 8 01:23:05 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6a7da2e30dc38ba92875bfe1da5520c950bab1e3
      https://github.com/llvm/llvm-project/commit/6a7da2e30dc38ba92875bfe1da5520c950bab1e3
  Author: jeanPerier <jperier at nvidia.com>
  Date:   2024-04-08 (Mon, 08 Apr 2024)

  Changed paths:
    M flang/lib/Lower/Allocatable.cpp
    A flang/test/Lower/allocate-source-allocatables-2.f90

  Log Message:
  -----------
  [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.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list