git: ff1c63671b73 - main - kdb_sysctl_trap: suppress gcc -Warray-bounds

From: Ryan Libby <rlibby_at_FreeBSD.org>
Date: Tue, 09 Jul 2024 18:45:17 UTC
The branch main has been updated by rlibby:

URL: https://cgit.FreeBSD.org/src/commit/?id=ff1c63671b7372ef7d52da11d02e082876c22654

commit ff1c63671b7372ef7d52da11d02e082876c22654
Author:     Ryan Libby <rlibby@FreeBSD.org>
AuthorDate: 2024-07-09 17:58:21 +0000
Commit:     Ryan Libby <rlibby@FreeBSD.org>
CommitDate: 2024-07-09 17:58:21 +0000

    kdb_sysctl_trap: suppress gcc -Warray-bounds
    
    gcc diagnosed a dereference of 0x10 with -Warray-bounds, which is
    entirely sensible, except that this is a deliberate trap.  Throw gcc off
    with a volatile pointer.
    
    Reviewed by:    kib (previous version)
    Differential Revision:  https://reviews.freebsd.org/D45917
---
 sys/kern/subr_kdb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/kern/subr_kdb.c b/sys/kern/subr_kdb.c
index a7fc2284cbcf..56264a96c9fa 100644
--- a/sys/kern/subr_kdb.c
+++ b/sys/kern/subr_kdb.c
@@ -238,7 +238,7 @@ static int
 kdb_sysctl_trap(SYSCTL_HANDLER_ARGS)
 {
 	int error, i;
-	int *addr = (int *)0x10;
+	int *volatile addr = (int *)0x10;
 
 	error = sysctl_wire_old_buffer(req, sizeof(int));
 	if (error == 0) {