#
084d9436 |
| 28-Jun-2024 |
Peter Klausler <35819229+klausler@users.noreply.github.com> |
[flang] Fix excess allocation (#96663)
A recent patch introduced an error in an aligned byte size calculation
that causes an extra word to be allocated when the original byte size is
already align
[flang] Fix excess allocation (#96663)
A recent patch introduced an error in an aligned byte size calculation
that causes an extra word to be allocated when the original byte size is
already aligned (including the case of zero). Fix.
show more ...
|
#
514c1ec5 |
| 24-Jun-2024 |
Peter Klausler <35819229+klausler@users.noreply.github.com> |
[flang][runtime] Interoperable POINTER deallocation validation (#96100)
Extend the runtime validation of deallocated pointers so that it also
works when pointers are allocated &/or deallocated outs
[flang][runtime] Interoperable POINTER deallocation validation (#96100)
Extend the runtime validation of deallocated pointers so that it also
works when pointers are allocated &/or deallocated outside Fortran.
Previously, bogus runtime errors would be reported for pointers
allocated via CFI_allocate() and deallocated in Fortran, and
CFI_deallocate() did not check that it was deallocating a whole
contiguous pointer that was allocated as such.
show more ...
|
Revision tags: llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3 |
|
#
8ebf7411 |
| 25-Mar-2024 |
Slava Zakharin <szakharin@nvidia.com> |
[flang][runtime] Prepare enabling PRINT of integer32 for device. (#86247)
This commit adds required files into the offload build closure,
which means adding RT_API_ATTRS and other markers.
The i
[flang][runtime] Prepare enabling PRINT of integer32 for device. (#86247)
This commit adds required files into the offload build closure,
which means adding RT_API_ATTRS and other markers.
The implementation does not work for CUDA yet, because of
std::variant,swap,reverse usage. These issues will be resolved
separately (e.g. by using libcudacxx header files).
show more ...
|
Revision tags: llvmorg-18.1.2 |
|
#
c08d70a5 |
| 14-Mar-2024 |
Slava Zakharin <szakharin@nvidia.com> |
[flang][runtime] Temporary fix for unresolved reference in CUDA F18 runtime. (#85294)
Avoid referencing executionEnvironment in the device code, since
environment.cpp is not part of the CUDA build
[flang][runtime] Temporary fix for unresolved reference in CUDA F18 runtime. (#85294)
Avoid referencing executionEnvironment in the device code, since
environment.cpp is not part of the CUDA build yet.
This is a temporary fix before #85182 is merged.
show more ...
|
#
af964c7e |
| 13-Mar-2024 |
Peter Klausler <35819229+klausler@users.noreply.github.com> |
[flang][runtime] Let FORT_CHECK_POINTER_DEALLOCATION=0 disable runtime … (#84956)
…check
Add an environment variable by which a user can disable the pointer
validation check in DEALLOCATE statem
[flang][runtime] Let FORT_CHECK_POINTER_DEALLOCATION=0 disable runtime … (#84956)
…check
Add an environment variable by which a user can disable the pointer
validation check in DEALLOCATE statement handling. This is not safe, but
it can help make a code work that allocates a pointer with an extended
derived type, associates its target with a pointer to one of its
ancestor types, and then deallocates that pointer.
show more ...
|
Revision tags: llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1 |
|
#
a3bbe627 |
| 25-Jan-2024 |
Peter Klausler <35819229+klausler@users.noreply.github.com> |
[flang][runtime] Validate pointer DEALLOCATE (#78612)
The standard requires a compiler to diagnose an incorrect use of a
pointer in a DEALLOCATE statement. The pointer must be associated with
an e
[flang][runtime] Validate pointer DEALLOCATE (#78612)
The standard requires a compiler to diagnose an incorrect use of a
pointer in a DEALLOCATE statement. The pointer must be associated with
an entire object that was allocated as a pointer (not allocatable) by an
ALLOCATE statement.
Implement by appending a validation footer to pointer allocations. This
is an extra allocated word that encodes the base address of the
allocation. If it is not found after the data payload when the pointer
is deallocated, signal an error. There is a chance of a false positive
result, but that should be vanishingly unlikely.
This change requires all pointer allocations (not allocatables) to take
place in the runtime in PointerAllocate(), which might be slower in
cases that could otherwise be handled with a native memory allocation
operation. I believe that memory allocation of pointers is less common
than with allocatables, which are not affected. If this turns out to
become a performance problem, we can inline the creation and
initialization of the footer word.
Fixes https://github.com/llvm/llvm-project/issues/78391.
show more ...
|
Revision tags: llvmorg-19-init |
|
#
76facde3 |
| 28-Dec-2023 |
Slava Zakharin <szakharin@nvidia.com> |
[flang][runtime] Enable more APIs in the offload build. (#76486)
|
Revision tags: llvmorg-17.0.6, llvmorg-17.0.5, llvmorg-17.0.4 |
|
#
dffd93b3 |
| 17-Oct-2023 |
Peter Klausler <35819229+klausler@users.noreply.github.com> |
[flang][runtime] Fix SAME_TYPE_AS()/EXTENDS_TYPE_OF() for CLASS(*) (#67727)
Ensure that the f18Addendum flag is preserved in AllocatableApplyMold(),
that raw().type is reinitialized in AllocatableD
[flang][runtime] Fix SAME_TYPE_AS()/EXTENDS_TYPE_OF() for CLASS(*) (#67727)
Ensure that the f18Addendum flag is preserved in AllocatableApplyMold(),
that raw().type is reinitialized in AllocatableDeallocatePolymorphic(),
and that the implementations of SameTypeAs() and ExtendsTypeOf() handle
unallocated unlimited polymorphic arguments correctly.
show more ...
|
Revision tags: llvmorg-17.0.3, llvmorg-17.0.2, llvmorg-17.0.1, llvmorg-17.0.0 |
|
#
79508db4 |
| 18-Sep-2023 |
jeanPerier <jperier@nvidia.com> |
[flang][runtime] zero size allocation in source allocation (#66124)
Source allocation with a zero sized array is legal, and the resulting
allocatable/pointer should be allocated/associated.
The
[flang][runtime] zero size allocation in source allocation (#66124)
Source allocation with a zero sized array is legal, and the resulting
allocatable/pointer should be allocated/associated.
The current code skipped the actual allocation, leading the allocatable
or pointer to look unallocated/disassociated.
show more ...
|
Revision tags: llvmorg-17.0.0-rc4, llvmorg-17.0.0-rc3, llvmorg-17.0.0-rc2 |
|
#
b21c24c3 |
| 29-Jul-2023 |
Peter Klausler <pklausler@nvidia.com> |
[flang][runtime] Recognize and handle FINAL subroutines with contiguous dummy arrays when data are not so
When a FINAL subroutine is being invoked for a discontiguous array, which can happen for INT
[flang][runtime] Recognize and handle FINAL subroutines with contiguous dummy arrays when data are not so
When a FINAL subroutine is being invoked for a discontiguous array, which can happen for INTENT(OUT) dummy arguments and for some left-hand side variables in intrinsic assignment statements, it may be the case that the subroutine being called was defined with a dummy argument that requires contiguous data.
Extend the derived type descriptions used by the runtime to signify when a special procedure binding requires contiguity; set the flags accordingly; check them in the runtime support library, and, when necessary, use a temporary shallow copy of the finalized array data in the call to the final subroutine.
Differential Revision: https://reviews.llvm.org/D156760
show more ...
|
Revision tags: llvmorg-17.0.0-rc1, llvmorg-18-init, llvmorg-16.0.6, llvmorg-16.0.5, llvmorg-16.0.4, llvmorg-16.0.3, llvmorg-16.0.2, llvmorg-16.0.1, llvmorg-16.0.0, llvmorg-16.0.0-rc4 |
|
#
a29d7463 |
| 09-Mar-2023 |
Valentin Clement <clementval@gmail.com> |
[flang] Only apply PointerIsAssociatedWith fix for derived-type
Only apply the change made in D145604 for derived-type. zero-sized character for example are supposed to give a false result
Reviewed
[flang] Only apply PointerIsAssociatedWith fix for derived-type
Only apply the change made in D145604 for derived-type. zero-sized character for example are supposed to give a false result
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D145675
show more ...
|
#
4235bf7a |
| 08-Mar-2023 |
Valentin Clement <clementval@gmail.com> |
[flang] Adapt PointerIsAssociatedWith for empty derived-type
When a derived-type as no component, its elem_len will be set to zero when emboxed. Update the function to let empty derived-type pointer
[flang] Adapt PointerIsAssociatedWith for empty derived-type
When a derived-type as no component, its elem_len will be set to zero when emboxed. Update the function to let empty derived-type pointer/target succeed the test.
Example extracted from gfortran test pointer_init_8
``` module m type :: c end type c type, extends(c) :: d end type d type(c), target :: x end module
use m class(c), pointer :: px => x
if (.not. associated(px, x)) STOP 1 end ```
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D145604
show more ...
|
#
ff0ca64e |
| 28-Feb-2023 |
Valentin Clement <clementval@gmail.com> |
[flang] Use unsigned to avoid comparison warning
|
#
91ee72d1 |
| 28-Feb-2023 |
Valentin Clement <clementval@gmail.com> |
[flang] Fix potential segfault in PointerAssociateRemapping
The bounds descriptor passed to the function is an array of [2, newRank] size. Update the code so the rank is retrieved from the second di
[flang] Fix potential segfault in PointerAssociateRemapping
The bounds descriptor passed to the function is an array of [2, newRank] size. Update the code so the rank is retrieved from the second dimension and not the rank of the descriptor directly as it will be 2 in any case.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D144949
show more ...
|
Revision tags: llvmorg-16.0.0-rc3 |
|
#
ac84bc3c |
| 20-Feb-2023 |
Valentin Clement <clementval@gmail.com> |
[flang] Carry over the derived type from target in pointer remapping
When calling PointerAssociateRemapping the dynamic type information from the target needs to be carried over to the pointer if an
[flang] Carry over the derived type from target in pointer remapping
When calling PointerAssociateRemapping the dynamic type information from the target needs to be carried over to the pointer if any.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D143717
show more ...
|
Revision tags: llvmorg-16.0.0-rc2 |
|
#
755535b5 |
| 01-Feb-2023 |
Peter Klausler <pklausler@nvidia.com> |
[flang][runtime] Handle aliasing in Assign()
Detect and handle LHS/RHS aliasing when effecting intrinsic assignments via the Assign() runtime function.
Also: don't apply special handling for alloca
[flang][runtime] Handle aliasing in Assign()
Detect and handle LHS/RHS aliasing when effecting intrinsic assignments via the Assign() runtime function.
Also: don't apply special handling for allocatable LHS when calling a user-defined type-bound ASSIGNMENT(=) generic procedure for a polymorphic type, and refactor some code into utility functions to make Assign() more comprehensible.
Differential Revision: https://reviews.llvm.org/D144026
show more ...
|
#
6a63e21c |
| 08-Feb-2023 |
Valentin Clement <clementval@gmail.com> |
[flang] Fix rank and byte stride in pointer remapping
In some remapping case the rank of the pointer is different from the target one.
``` program remap type :: p integer :: a end type t
[flang] Fix rank and byte stride in pointer remapping
In some remapping case the rank of the pointer is different from the target one.
``` program remap type :: p integer :: a end type t type(p), target :: ta(10) = [ (t(i),i=1,10) ] class(t), pointer :: p(:,:) p(1:2,1:5) => ta end ```
This patch updates the rank and the byte stride to fix such case.
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D143566
show more ...
|
#
b37e3597 |
| 08-Feb-2023 |
Valentin Clement <clementval@gmail.com> |
[flang] Carry over the derived type from MOLD
Derived type from the MOLD was not carried over to the newly allocated pointer or allocatable. This may lead to wrong dynamic type when the pointer or a
[flang] Carry over the derived type from MOLD
Derived type from the MOLD was not carried over to the newly allocated pointer or allocatable. This may lead to wrong dynamic type when the pointer or allocatable is polymorphic as shown in the example below:
``` type :: p1 integer :: a end type
type, extends(p1) :: p2 integer :: b end type
class(p1), pointer :: p(:)
allocate(p(5), MOLD=p2(1,2)) ```
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D143525
show more ...
|
#
696ad139 |
| 02-Feb-2023 |
Valentin Clement <clementval@gmail.com> |
[flang] Use rank from the allocate object when allocate with mold
The rank from the allocate object might be different from the rank from the mold expression. Use the rank from the allocate object w
[flang] Use rank from the allocate object when allocate with mold
The rank from the allocate object might be different from the rank from the mold expression. Use the rank from the allocate object when applying to mold so the bounds can be set correctly.
Reviewed By: jeanPerier
Differential Revision: https://reviews.llvm.org/D143078
show more ...
|
#
f783c9bb |
| 01-Feb-2023 |
Peixin Qiao <qiaopeixin@huawei.com> |
[flang] Support allocate array from scalar source in runtime
As Fortran 2018 9.7.1.2(7), the value of each element of allocate object becomes the value of source when the allocate object is array an
[flang] Support allocate array from scalar source in runtime
As Fortran 2018 9.7.1.2(7), the value of each element of allocate object becomes the value of source when the allocate object is array and the source is scalar.
Fix #60090.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D142112
show more ...
|
Revision tags: llvmorg-16.0.0-rc1 |
|
#
7aa8a9f1 |
| 25-Jan-2023 |
Valentin Clement <clementval@gmail.com> |
[flang] Fix bounds array creation for pointer remapping calls
`PointerAssociateRemapping` expect a descriptor holding a newRank x 2 array of int64. The previous lowering was wrong. Adapt the lowerin
[flang] Fix bounds array creation for pointer remapping calls
`PointerAssociateRemapping` expect a descriptor holding a newRank x 2 array of int64. The previous lowering was wrong. Adapt the lowering to fit the expectation of the runtime. Use the `bounds` to get the rank.
Reviewed By: PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D142487
show more ...
|
Revision tags: llvmorg-17-init |
|
#
9ae4e1ae |
| 18-Jan-2023 |
Valentin Clement <clementval@gmail.com> |
[flang] Do not perform INTERNAL_CHECK for deallocation of unlimited polymorphic with intrinsic type spec
When an unlimited polymorphic descriptor is establish for an intrinsic type spec, the `Pointe
[flang] Do not perform INTERNAL_CHECK for deallocation of unlimited polymorphic with intrinsic type spec
When an unlimited polymorphic descriptor is establish for an intrinsic type spec, the `PointerNullifyIntrinsic` or `AllocatableInitIntrinsic` runtime function is called. These functions do not initialize an addendum with a derivedType. When the deallocation on this descriptor is performed, the runtime should not crash if the addendum is not present. This patch updates `PointerDeallocatePolymorphic` and `AllocatableDeallocatePolymorphic` for this use case.
Depends on D141996
Reviewed By: jeanPerier, PeteSteinfeld
Differential Revision: https://reviews.llvm.org/D142010
show more ...
|
#
8c77c011 |
| 13-Jan-2023 |
Peixin Qiao <qiaopeixin@huawei.com> |
[flang] Initial support of allocate statement with source
Support allocate statement with source in runtime version. The source expression is evaluated only once for each allocate statement. When th
[flang] Initial support of allocate statement with source
Support allocate statement with source in runtime version. The source expression is evaluated only once for each allocate statement. When the source expression has shape-spec, uses it for bounds. Otherwise, get the bounds from the source expression. Get the length if the source expression has deferred length parameter.
Reviewed By: clementval, jeanPerier
Differential Revision: https://reviews.llvm.org/D137812
show more ...
|
#
01e8e50c |
| 12-Jan-2023 |
Valentin Clement <clementval@gmail.com> |
[flang] Restore declared type when deallocating polymorphic entities
As mentioned in section 7.3.2.3 note 7, The dynamic type of an unallocated allocatable object or a disassociated pointer is the s
[flang] Restore declared type when deallocating polymorphic entities
As mentioned in section 7.3.2.3 note 7, The dynamic type of an unallocated allocatable object or a disassociated pointer is the same as its declared type.
This patch adds two function to the runtime: - `PointerDeallocatePolymorphic` - `AllocatableDeallocatePolymorphic`
These two functions take a DerivedTypeDesc pointer of the declared type. The lowering is updated accordingly to call these functions for polymorphic and unlimited polyrmophic entities. For unlimited polymorphic entities, the dynamic type is set to nullptr when the entity is on an unallocated or disassociated state.
Reviewed By: PeteSteinfeld, klausler
Differential Revision: https://reviews.llvm.org/D141519
show more ...
|
Revision tags: llvmorg-15.0.7 |
|
#
87dfec9d |
| 05-Dec-2022 |
Valentin Clement <clementval@gmail.com> |
[flang] Retrieve rank before updating the pointer
The code is iterating on the rank of the pointer to set the bounds. If the rank is retrieved after the `pointer = target` it does not reflect the ac
[flang] Retrieve rank before updating the pointer
The code is iterating on the rank of the pointer to set the bounds. If the rank is retrieved after the `pointer = target` it does not reflect the actual rank of the pointer.
This could happen in code like the following:
``` type t1 integer :: a end type
type(t), pointer :: p(:) class(t), pointer :: q(:,:) q(0:1,-2:2) => p(10:1:-1) ```
Reviewed By: klausler
Differential Revision: https://reviews.llvm.org/D139327
show more ...
|