This patch primarily updates the MapInfoFinalization pass to utilise the BlockArgument interface. It also shuffles newly added arguments the MapInfoFinalization passes to the end of the BlockArg/Relevant MapInfo lists, instead of one prior to the owning descriptor type. During this it was noted that the use_device_ptr/addr handling of target data was a little bit too order dependent so I've attempted to make it less so, as we cannot depend on argument ordering to be the same as Fortran for any future frontends.
24 lines
487 B
C
24 lines
487 B
C
// Helper function used in Offload Fortran test
|
|
// target-use-dev-ptr.f90 to allocate data and
|
|
// check resulting addresses.
|
|
|
|
#include <assert.h>
|
|
#include <malloc.h>
|
|
#include <stdio.h>
|
|
|
|
int *get_ptr() {
|
|
int *ptr = malloc(sizeof(int));
|
|
assert(ptr && "malloc returned null");
|
|
return ptr;
|
|
}
|
|
|
|
int check_result(int *host_ptr, int *dev_ptr) {
|
|
if (dev_ptr == NULL || dev_ptr == host_ptr) {
|
|
printf("FAILURE\n");
|
|
return -1;
|
|
} else {
|
|
printf("SUCCESS\n");
|
|
return 0;
|
|
}
|
|
}
|