Local vars, marked with pragma allocate, mustbe allocate by the call of
the runtime function and cannot be allocated as other local variables.
Instead, we allocate a space for the pointer in private record and store
the address, returned by kmpc_alloc call in this pointer.
So, for untied tasks
#pragma omp task untied { S s; #pragma omp allocate(s) allocator(allocator) s = x; }
compiler generates something like this:
struct task_with_privates { S *ptr; }; void entry(task_with_privates *p) { S *s = p->s; switch(partid) { case 1: p->s = (S*)kmpc_alloc(); kmpc_omp_task(); br exit; case 2: *s = x; kmpc_omp_task(); br exit; case 2: ~S(s); kmpc_free((void*)s); br exit; } exit: }