-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
enhancementNew feature or requestNew feature or requestlong-termIssues will be addressed sometime the futureIssues will be addressed sometime the future
Description
TypeART should be configurable for user-defined allocation (and deallocation) functions
Consider the AMG multi grid solver.
AMG uses macros for memory allocation, e.g., a calloc-like implementation:
#define hypre_CTAlloc(type, count) \
( (type *)hypre_CAlloc((unsigned int)(count), (unsigned int)sizeof(type)) )In turn the called function looks approximately like this:
char* hypre_CAlloc(int count, int elt_size) {
char* ptr;
int size = count * elt_size;
ptr = calloc(count, elt_size);
return ptr;
}The defect:
Assume a call like:
double* a = hypre_CTAlloc(double, num_variables);- Our static pass is not aware of this macro, it instead finds the C
calloc. - Thus, it deduces the
char*type for thatcalloc, which is put into our runtime. - The subsequent cast of the
char*returned byhypre_CAlloctodoubleis not found by our current implementation.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestlong-termIssues will be addressed sometime the futureIssues will be addressed sometime the future