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

via flang-commits flang-commits at lists.llvm.org
Wed Nov 29 17:16:56 PST 2023


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 8b9a6af4504a9a160bb1da0abced9c538b3af26b 82a156eb115e0796688f835a47344c3f3d4648d0 -- flang/runtime/ISO_Fortran_binding.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/flang/runtime/ISO_Fortran_binding.cpp b/flang/runtime/ISO_Fortran_binding.cpp
index e2888464dc..20bd42adbd 100644
--- a/flang/runtime/ISO_Fortran_binding.cpp
+++ b/flang/runtime/ISO_Fortran_binding.cpp
@@ -75,14 +75,14 @@ RT_API_ATTRS int CFI_allocate(CFI_cdesc_t *descriptor,
     dim->sm = byteSize;
     byteSize *= extent;
   }
-  #ifdef _AIX
-    if (!byteSize)
-      void *p{std::malloc(1)};
-    else
-      void *p{std::malloc(byteSize)};
-  #else
+#ifdef _AIX
+  if (!byteSize)
+    void *p{std::malloc(1)};
+  else
     void *p{std::malloc(byteSize)};
-  #endif
+#else
+  void *p{std::malloc(byteSize)};
+#endif
   if (!p && byteSize) {
     return CFI_ERROR_MEM_ALLOCATION;
   }

``````````

</details>


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


More information about the flang-commits mailing list