[llvm-branch-commits] [openmp] 074ad6d - [OpenMP] libomp: fix build by cl with vs2019

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jan 29 22:12:10 PST 2021


Author: AndreyChurbanov
Date: 2021-01-29T21:59:44-08:00
New Revision: 074ad6de6fae20ff7ff720f79df1d6c1a7845157

URL: https://github.com/llvm/llvm-project/commit/074ad6de6fae20ff7ff720f79df1d6c1a7845157
DIFF: https://github.com/llvm/llvm-project/commit/074ad6de6fae20ff7ff720f79df1d6c1a7845157.diff

LOG: [OpenMP] libomp: fix build by cl with vs2019

Replace VLA with dynamic allocation using alloca().
This fixes https://bugs.llvm.org/show_bug.cgi?id=48919.

Differential Revision: https://reviews.llvm.org/D95627

(cherry picked from commit 7f5ad0e07162e0c19e569986ee37a17c147c9a27)

Added: 
    

Modified: 
    openmp/runtime/src/kmp_settings.cpp

Removed: 
    


################################################################################
diff  --git a/openmp/runtime/src/kmp_settings.cpp b/openmp/runtime/src/kmp_settings.cpp
index a8522130f972..b477edbbfb42 100644
--- a/openmp/runtime/src/kmp_settings.cpp
+++ b/openmp/runtime/src/kmp_settings.cpp
@@ -3355,7 +3355,8 @@ static void __kmp_stg_parse_allocator(char const *name, char const *value,
         ntraits++;
     }
   }
-  omp_alloctrait_t traits[ntraits];
+  omp_alloctrait_t *traits =
+      (omp_alloctrait_t *)KMP_ALLOCA(ntraits * sizeof(omp_alloctrait_t));
 
 // Helper macros
 #define IS_POWER_OF_TWO(n) (((n) & ((n)-1)) == 0)


        


More information about the llvm-branch-commits mailing list