libgomp/testsuite/libgomp.oacc-c-c++-common/pr92726-1.c
raw| 1 | /* Verify that 'acc_delete' etc. with a 'NULL' address is a no-op. */ |
| 2 | |
| 3 | #include <assert.h> |
| 4 | #include <stdlib.h> |
| 5 | #include <openacc.h> |
| 6 | |
| 7 | int |
| 8 | main (int argc, char **argv) |
| 9 | { |
| 10 | const int N = 256; |
| 11 | |
| 12 | unsigned char *a = (unsigned char *) malloc (N); |
| 13 | assert (a); |
| 14 | |
| 15 | void *a_d = acc_create (a, N); |
| 16 | assert (a_d); |
| 17 | |
| 18 | acc_delete (NULL, N); |
| 19 | assert (acc_is_present (a, N)); |
| 20 | //TODO similar for others. |
| 21 | |
| 22 | acc_delete (a, N); |
| 23 | free (a); |
| 24 | |
| 25 | return 0; |
| 26 | } |