[PATCH 3/4] mdadm: Avoid array bounds check of gcc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With gcc version 13.2.1 20230918 (Red Hat 13.2.1-3) (GCC), it reports error:
super-ddf.c:1988:58: error: array subscript -1 is below array bounds of
‘struct phys_disk_entry[0]’ [-Werror=array-bounds=]
The subscrit is defined as int type. And it can be smaller than 0.
To avoid this error, add -Wno-array-bounds flag in Makefile.

Signed-off-by: Xiao Ni <xni@xxxxxxxxxx>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 5eac1a4e9690..47da883a9fb9 100644
--- a/Makefile
+++ b/Makefile
@@ -50,7 +50,7 @@ ifeq ($(origin CC),default)
 CC := $(CROSS_COMPILE)gcc
 endif
 CXFLAGS ?= -ggdb
-CWFLAGS = -Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter
+CWFLAGS = -Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter -Wno-array-bounds
 ifdef WARN_UNUSED
 CWFLAGS += -Wp,-D_FORTIFY_SOURCE=2 -O3
 endif
-- 
2.32.0 (Apple Git-132)




[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux