[Openmp-commits] [openmp] d3d8103 - [OpenMP] Using `SimpleVLA` to handle vla usage in ompt-general.cpp. (#114583)
via Openmp-commits
openmp-commits at lists.llvm.org
Mon Nov 4 09:42:19 PST 2024
Author: Daniel Chen
Date: 2024-11-04T12:42:16-05:00
New Revision: d3d8103d533280f322383e35cf5a9fe3075e236c
URL: https://github.com/llvm/llvm-project/commit/d3d8103d533280f322383e35cf5a9fe3075e236c
DIFF: https://github.com/llvm/llvm-project/commit/d3d8103d533280f322383e35cf5a9fe3075e236c.diff
LOG: [OpenMP] Using `SimpleVLA` to handle vla usage in ompt-general.cpp. (#114583)
The `openmp` runtime failed to build on LoP with LLVM18 on LoP due to
the addition of `-Wvla-cxx-extension` as
```
llvm-project/openmp/runtime/src/ompt-general.cpp:711:15: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension]
711 | int tmp_ids[ids_size];
| ^~~~~~~~
llvm-project/openmp/runtime/src/ompt-general.cpp:711:15: note: function parameter 'ids_size' with unknown value cannot be used in a constant expression
llvm-project/openmp/runtime/src/ompt-general.cpp:704:65: note: declared here
704 | OMPT_API_ROUTINE int ompt_get_place_proc_ids(int place_num, int ids_size,
| ^
1 error generated.
```
This patch is to ignore the checking against this usage.
Added:
Modified:
openmp/runtime/src/ompt-general.cpp
Removed:
################################################################################
diff --git a/openmp/runtime/src/ompt-general.cpp b/openmp/runtime/src/ompt-general.cpp
index 923eea2a563a91..cd738f066fcfcf 100644
--- a/openmp/runtime/src/ompt-general.cpp
+++ b/openmp/runtime/src/ompt-general.cpp
@@ -10,10 +10,11 @@
//
//===----------------------------------------------------------------------===//
+#include "kmp_utils.h"
+
/*****************************************************************************
* system include files
****************************************************************************/
-
#include <assert.h>
#include <stdint.h>
@@ -708,7 +709,7 @@ OMPT_API_ROUTINE int ompt_get_place_proc_ids(int place_num, int ids_size,
return 0;
#else
int i, count;
- int tmp_ids[ids_size];
+ SimpleVLA<int> tmp_ids(ids_size);
for (int j = 0; j < ids_size; j++)
tmp_ids[j] = 0;
if (!KMP_AFFINITY_CAPABLE())
More information about the Openmp-commits
mailing list