[Openmp-commits] [openmp] 7f5ad0e - [OpenMP] libomp: fix build by cl with vs2019

via Openmp-commits openmp-commits at lists.llvm.org
Fri Jan 29 02:17:07 PST 2021


Author: AndreyChurbanov
Date: 2021-01-29T13:16:41+03:00
New Revision: 7f5ad0e07162e0c19e569986ee37a17c147c9a27

URL: https://github.com/llvm/llvm-project/commit/7f5ad0e07162e0c19e569986ee37a17c147c9a27
DIFF: https://github.com/llvm/llvm-project/commit/7f5ad0e07162e0c19e569986ee37a17c147c9a27.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

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 9baf705df9c5..3d9bdb384861 100644
--- a/openmp/runtime/src/kmp_settings.cpp
+++ b/openmp/runtime/src/kmp_settings.cpp
@@ -3377,7 +3377,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 Openmp-commits mailing list