Changes to acc_malloc and acc_free #95
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#89
Updated test replaces the incorrect usage of acc_malloc and acc_free from earlier versions.
The original test used an INTEGER POINTER and assumed acc_malloc could directly allocate into Fortran arrays, which is not valid. It also passed incompatible types to acc_free.
In the revised version, acc_malloc is properly used to return a C_PTR as specified by
the OpenACC API, and acc_free is correctly called with an argument of TYPE(C_PTR).
The test now uses ISO_C_BINDING to ensure type safety and portability, computing
allocation size using C_SIZEOF and ensuring the size is passed as a C_SIZE_T.
Additionally, the test checks pointer validity using C_ASSOCIATED and validates memory
restoration using precise comparisons between initial and final free memory values.