[flang-commits] [flang] [Flang] malloc(1) on AIX as malloc(0) returns nullptr (PR #73878)
Daniel Chen via flang-commits
flang-commits at lists.llvm.org
Thu Nov 30 08:15:59 PST 2023
================
@@ -75,7 +75,14 @@ RT_API_ATTRS int CFI_allocate(CFI_cdesc_t *descriptor,
dim->sm = byteSize;
byteSize *= extent;
}
+#ifdef _AIX
----------------
DanielCChen wrote:
I think we could just do
```
void *p = byteSize ? std::malloc(byteSize) : nullptr;
```
Because the next check would already issue CFI_ERROR_MEM_ALLOCATION if `byteSize` is zero.
https://github.com/llvm/llvm-project/pull/73878
More information about the flang-commits
mailing list