Module Name:    src
Committed By:   rin
Date:           Tue Sep 24 11:17:54 UTC 2024

Modified Files:
        src/sys/arch/luna68k/stand/boot: init_main.c

Log Message:
luna68k: stand: Silence GCC12 -Warray-bounds for main()

- LUNA1_BOOTINFOADDR (0x8c0) is in the 0-th page [0, 0x1000), which
  causes -Warray-bounds for GCC12 and later.
- LUNA2_BOOTINFOADDR (0x1d80) is also in the 0-th page, if we switch to
  8KB page.

Fix luna68k build with GCC12.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/luna68k/stand/boot/init_main.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/luna68k/stand/boot/init_main.c
diff -u src/sys/arch/luna68k/stand/boot/init_main.c:1.16 src/sys/arch/luna68k/stand/boot/init_main.c:1.17
--- src/sys/arch/luna68k/stand/boot/init_main.c:1.16	Sat Feb 14 13:07:39 2015
+++ src/sys/arch/luna68k/stand/boot/init_main.c	Tue Sep 24 11:17:54 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: init_main.c,v 1.16 2015/02/14 13:07:39 tsutsui Exp $	*/
+/*	$NetBSD: init_main.c,v 1.17 2024/09/24 11:17:54 rin Exp $	*/
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -226,6 +226,15 @@ main(void)
 	unit = 0;
 	part = 0;
 
+/*
+ * - LUNA1_BOOTINFOADDR is in the 0-th page [0, 0x1000), which causes
+ *   -Warray-bounds for GCC12 and later.
+ * - LUNA2_BOOTINFOADDR is also in the 0-th page, if we switch to
+ *   8KB page.
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
+
 	if (machtype == LUNA_I) {
 		const struct luna1_bootinfo *bi1 = (void *)LUNA1_BOOTINFOADDR;
 
@@ -286,6 +295,8 @@ main(void)
 #endif
 	}
 
+#pragma GCC diagnostic pop
+
 	snprintf(default_file, sizeof(default_file),
 	    "%s(%d,%d)%s", bootdev, unit, part, "netbsd");
 	default_bootdev = bootdev;

Reply via email to