[flang-commits] [flang] [flang][runtime] Enable more APIs in the	offload build. (PR #76486)
    Peter Klausler via flang-commits 
    flang-commits at lists.llvm.org
       
    Thu Dec 28 09:35:11 PST 2023
    
    
  
================
@@ -37,6 +37,16 @@
 #define STD_MEMCMP_UNSUPPORTED 1
 #endif
 
+#if !defined(STD_REALLOC_UNSUPPORTED) && \
----------------
klausler wrote:
`realloc` is used only in the runtime for array constructors, and `calloc` only in the runtime for ragged arrays, which I have never understood.  All other memory allocation and deallocation in the runtime goes through wrappers `AllocateMemory`, `AllocateMemoryOrCrash`, and `FreeMemory`.  (If there are loose instances of unwrapped `malloc()` or `operator new` that have snuck into the codebase, they're not from me.). Consider replacing the usage of `realloc` with calls to a new wrapper that isolates this macro logic, and replacing the usage of `calloc` with just `AllocateMemory` and `memset`.
https://github.com/llvm/llvm-project/pull/76486
    
    
More information about the flang-commits
mailing list