[Openmp-commits] [openmp] 4e27097 - [OpenMP] Fix the wrong format string used in `__kmpc_error`

Shilei Tian via Openmp-commits openmp-commits at lists.llvm.org
Mon Jan 16 20:55:31 PST 2023


Author: Shilei Tian
Date: 2023-01-16T23:55:26-05:00
New Revision: 4e27097c5bfb8a6b26ab67e86496730006683da9

URL: https://github.com/llvm/llvm-project/commit/4e27097c5bfb8a6b26ab67e86496730006683da9
DIFF: https://github.com/llvm/llvm-project/commit/4e27097c5bfb8a6b26ab67e86496730006683da9.diff

LOG: [OpenMP] Fix the wrong format string used in `__kmpc_error`

This patch fixes the wrong format string used in `__kmpc_error`, which could
cause segment fault at runtime.

Reviewed By: jlpeyton

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

Added: 
    

Modified: 
    openmp/runtime/src/kmp_csupport.cpp

Removed: 
    


################################################################################
diff  --git a/openmp/runtime/src/kmp_csupport.cpp b/openmp/runtime/src/kmp_csupport.cpp
index 64b9d162c892..1d654191063d 100644
--- a/openmp/runtime/src/kmp_csupport.cpp
+++ b/openmp/runtime/src/kmp_csupport.cpp
@@ -4453,7 +4453,7 @@ void __kmpc_error(ident_t *loc, int severity, const char *message) {
   if (loc && loc->psource) {
     kmp_str_loc_t str_loc = __kmp_str_loc_init(loc->psource, false);
     src_loc =
-        __kmp_str_format("%s:%s:%s", str_loc.file, str_loc.line, str_loc.col);
+        __kmp_str_format("%s:%d:%d", str_loc.file, str_loc.line, str_loc.col);
     __kmp_str_loc_free(&str_loc);
   } else {
     src_loc = __kmp_str_format("unknown");


        


More information about the Openmp-commits mailing list