Skip to content

Commit 6be7c21

Browse files
committed
[OpenMP][libomp] Replace accidental VLA with KMP_ALLOCA
MSVC does not support variable length arrays. Replace with KMP_ALLOCA which is already used in the same file for stack-allocated variables.
1 parent 6f17768 commit 6be7c21

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

openmp/runtime/src/kmp_affinity.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ bool kmp_topology_t::filter_hw_subset() {
948948
bool using_core_effs = false;
949949
int hw_subset_depth = __kmp_hw_subset->get_depth();
950950
kmp_hw_t specified[KMP_HW_LAST];
951-
int topology_levels[hw_subset_depth];
951+
int *topology_levels = (int *)KMP_ALLOCA(sizeof(int) * hw_subset_depth);
952952
KMP_ASSERT(hw_subset_depth > 0);
953953
KMP_FOREACH_HW_TYPE(i) { specified[i] = KMP_HW_UNKNOWN; }
954954
int core_level = get_level(KMP_HW_CORE);

0 commit comments

Comments
 (0)