[all-commits] [llvm/llvm-project] d26a64: [flang] Do not leave length parameters uninitializ...
jeanPerier via All-commits
all-commits at lists.llvm.org
Thu Feb 15 23:51:15 PST 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: d26a6464f85fc224dc2f3ddb67d404ba82a331fa
https://github.com/llvm/llvm-project/commit/d26a6464f85fc224dc2f3ddb67d404ba82a331fa
Author: jeanPerier <jperier at nvidia.com>
Date: 2024-02-16 (Fri, 16 Feb 2024)
Changed paths:
M flang/include/flang/Runtime/descriptor.h
M flang/lib/Optimizer/CodeGen/CodeGen.cpp
M flang/test/Fir/ignore-missing-type-descriptor.fir
M flang/test/Fir/polymorphic.fir
M flang/test/Fir/tbaa.fir
M flang/test/Fir/type-descriptor.fir
M flang/test/Lower/allocatable-polymorphic.f90
Log Message:
-----------
[flang] Do not leave length parameters uninitialized in descriptor addendums (#81858)
Descriptor addendum have a field to hold length parameters (currently
only one). This field is currently never used because flang does not
lowered derived types with length parameters.
However, leaving it uninitialized is causing bugs in code like gFTL
where the code is trying to sort POINTERs (see [1]). More precisely, it
is an issue when two pointers should compare equal (same base address),
because the uninitialized values in the addendum may differ depending on
the "stack history" and optimization level.
Always initialized the length parameters field in the addendum to zero.
[1]:
https://github.com/Goddard-Fortran-Ecosystem/gFTL/blob/dc93a5fc2fe2b487590580d9f0a17d77ca3fe5c1/include/v1/templates/set_impl.inc#L312
The type being transferred to an integer array may look like:
```
TYPE :: localwrapper
TYPE(T), POINTER :: item
END TYPE localwrapper
```
Which in flang case ends-up transferring a descriptor to an integer
array, the code in gFTL later compare the integer arrays. This logic is
used when building set data structures in gFTL.
More information about the All-commits
mailing list