[flang-commits] [flang] [Flang] malloc(1) on AIX as malloc(0) returns nullptr (PR #73878)

via flang-commits flang-commits at lists.llvm.org
Tue Dec 5 00:54:04 PST 2023


================
@@ -75,7 +75,7 @@ RT_API_ATTRS int CFI_allocate(CFI_cdesc_t *descriptor,
     dim->sm = byteSize;
     byteSize *= extent;
   }
-  void *p{std::malloc(byteSize)};
+  void *p = byteSize ? std::malloc(byteSize) : std::malloc(1);
----------------
jeanPerier wrote:

nit: runtime code use braces in all initializations: `void *p{byteSize ? std::malloc(byteSize) : std::malloc(1)};`.

LGTM otherwise.

https://github.com/llvm/llvm-project/pull/73878


More information about the flang-commits mailing list