[all-commits] [llvm/llvm-project] 5eb23d: [clang][OpenMP] Only accept char strings in the me...

Akash Manna via All-commits all-commits at lists.llvm.org
Thu Sep 24 07:34:17 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5eb23d2ae9f1dab06a31e5f9d7d64fa23a775604
      https://github.com/llvm/llvm-project/commit/5eb23d2ae9f1dab06a31e5f9d7d64fa23a775604
  Author: Akash Manna <akash.manna.mymail at gmail.com>
  Date:   2026-09-24 (Thu, 24 Sep 2026)

  Changed paths:
    M clang/docs/ReleaseNotes.md
    M clang/lib/Sema/SemaOpenMP.cpp
    A clang/test/OpenMP/error_message.c
    M clang/test/OpenMP/error_message.cpp
    M clang/test/OpenMP/parallel_message_messages.cpp

  Log Message:
  -----------
  [clang][OpenMP] Only accept char strings in the message clause (#226080)

Fixes #140338

The `message` clause accepted any character-typed string, checked with
`isAnyCharacterType()`, but everything that consumes it assumes a `char`
string: Sema evaluates it into a `std::string` for the compile-time
diagnostic, and codegen passes it straight to the `const char *`
parameter of `__kmpc_error` and `__kmpc_push_num_threads_strict`. When
the issue was filed this hit the assertion in
`StringLiteral::getString()`. Since #146405 the assert is gone, but the
underlying problem stayed: in C++ a wide literal like `message(L"bar")`
prints `b<NUL><NUL>` as the error text, and with `at(execution)` a
`wchar_t` array is emitted as the runtime's `char *` argument. C was
only spared because `wchar_t` is an integer typedef there, so the clause
was already rejected.

The clause now only accepts `char` element types, which is what the spec
requires (OpenMP 5.1 ยง2.5.4: msg-string is a string of `const char *`
type). Wide, `UTF-16/32` and C++20 `u8` literals get the existing
"expected string in 'clause message' - ignoring" warning and the
directive still fires with its generic message, matching what C already
did and what GCC does. Doing this at the single point where the clause
is built covers the diagnostic, both codegen paths, and template
instantiation without touching the evaluator.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list