diff --git a/meta-ohos-core/recipes-support/gnupg/gnupg_%.bbappend b/meta-ohos-core/recipes-support/gnupg/gnupg_%.bbappend
new file mode 100644
index 0000000000000000000000000000000000000000..5f7f07176d1d3e9f4c87c817ea8f834b1ab87e8c
--- /dev/null
+++ b/meta-ohos-core/recipes-support/gnupg/gnupg_%.bbappend
@@ -0,0 +1,11 @@
+# SPDX-FileCopyrightText: Huawei Inc.
+# SPDX-License-Identifier: Apache-2.0
+
+# gnupg uses zero-length array tricks causing array-bounds warnings.
+# The warnings have been verifited to be harmless in 2.2.20; 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"