[OpenMP] Fix the wrong format string used in `__kmpc_error`
authorShilei Tian <i@tianshilei.me>
Tue, 17 Jan 2023 04:55:17 +0000 (23:55 -0500)
committerShilei Tian <i@tianshilei.me>
Tue, 17 Jan 2023 04:55:26 +0000 (23:55 -0500)
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

openmp/runtime/src/kmp_csupport.cpp

index 64b9d16..1d65419 100644 (file)
@@ -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");