[Openmp-commits] [PATCH] D141889: [OpenMP] Fix the wrong format string used in `__kmpc_error`

Shilei Tian via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Jan 16 20:44:39 PST 2023


tianshilei1992 created this revision.
tianshilei1992 added reviewers: jdoerfert, hbae, AndreyChurbanov, protze.joachim.
Herald added subscribers: guansong, yaxunl.
Herald added a project: All.
tianshilei1992 requested review of this revision.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.

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


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141889

Files:
  openmp/runtime/src/kmp_csupport.cpp


Index: openmp/runtime/src/kmp_csupport.cpp
===================================================================
--- openmp/runtime/src/kmp_csupport.cpp
+++ openmp/runtime/src/kmp_csupport.cpp
@@ -4453,7 +4453,7 @@
   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");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141889.489690.patch
Type: text/x-patch
Size: 579 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230117/879b640b/attachment.bin>


More information about the Openmp-commits mailing list