diff --git a/meta-ohos-core/recipes-support/libpcre/libpcre2_%.bbappend b/meta-ohos-core/recipes-support/libpcre/libpcre2_%.bbappend
new file mode 100644
index 0000000000000000000000000000000000000000..aa54e193359331af9b58a123279b1fa859db933b
--- /dev/null
+++ b/meta-ohos-core/recipes-support/libpcre/libpcre2_%.bbappend
@@ -0,0 +1,12 @@
+# SPDX-FileCopyrightText: Huawei Inc.
+# SPDX-License-Identifier: Apache-2.0
+
+# -Werror=array-bounds gets confused over negative array indices in
+# pcre2test.
+# The warnings have been verifited to be harmless in 10.34; for extra
+# security, this should be re-checked after updating.
+#
+# Removing -Werror=array-bounds here allows us to use -Werror=array-bounds
+# globally in OPTIMIZE_FOR=security mode.
+
+TARGET_CFLAGS_remove = "-Werror=array-bounds"