[clang] [-Wunterminated-string-initialization] Handle C string literals ending with explicit '\0' (PR #143487)

LLVM Continuous Integration via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 26 01:46:04 PDT 2025


llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `llvm-clang-x86_64-sie-ubuntu-fast` running on `sie-linux-worker` while building `clang` at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/144/builds/28591

<details>
<summary>Here is the relevant piece of the build log for the reference</summary>

```
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'Clang :: Sema/attr-nonstring_safe.c' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/clang -cc1 -internal-isystem /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/lib/clang/21/include -nostdsysteminc -fsyntax-only -verify=compat,expected -Wunterminated-string-initialization /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/Sema/attr-nonstring_safe.c -x c # RUN: at line 1
+ /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/bin/clang -cc1 -internal-isystem /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/build/lib/clang/21/include -nostdsysteminc -fsyntax-only -verify=compat,expected -Wunterminated-string-initialization /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/Sema/attr-nonstring_safe.c -x c
error: diagnostics with 'error' severity seen but not expected: 
  File /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/Sema/attr-nonstring_safe.c Line 31: use of undeclared identifier 'u'
  File /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/Sema/attr-nonstring_safe.c Line 34: use of undeclared identifier 'U'
  File /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/Sema/attr-nonstring_safe.c Line 43: use of undeclared identifier 'u'
  File /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/Sema/attr-nonstring_safe.c Line 44: use of undeclared identifier 'U'
error: diagnostics with 'warning' severity expected but not seen: 
  File /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/Sema/attr-nonstring_safe.c Line 31 'compat-warning': initializer-string for character array is too long for C++, array size is 3 but initializer has size 4 (including the null terminating character)
  File /home/buildbot/buildbot-root/llvm-clang-x86_64-sie-ubuntu-fast/llvm-project/clang/test/Sema/attr-nonstring_safe.c Line 34 'compat-warning': initializer-string for character array is too long for C++, array size is 3 but initializer has size 4 (including the null terminating character)
6 errors generated.

--

********************


```

</details>

https://github.com/llvm/llvm-project/pull/143487


More information about the cfe-commits mailing list