Module Name:    src
Committed By:   mrg
Date:           Fri Aug  4 09:06:33 UTC 2023

Modified Files:
        src/sys/arch/evbarm/fdt: fdt_machdep.c
        src/sys/arch/riscv/riscv: riscv_machdep.c

Log Message:
avoid comparing arrays directly, compare the address of their first element.

found by GCC 12.


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/arch/evbarm/fdt/fdt_machdep.c
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/riscv/riscv/riscv_machdep.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/evbarm/fdt/fdt_machdep.c
diff -u src/sys/arch/evbarm/fdt/fdt_machdep.c:1.105 src/sys/arch/evbarm/fdt/fdt_machdep.c:1.106
--- src/sys/arch/evbarm/fdt/fdt_machdep.c:1.105	Mon Jul 10 07:01:48 2023
+++ src/sys/arch/evbarm/fdt/fdt_machdep.c	Fri Aug  4 09:06:33 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_machdep.c,v 1.105 2023/07/10 07:01:48 rin Exp $ */
+/* $NetBSD: fdt_machdep.c,v 1.106 2023/08/04 09:06:33 mrg Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill <jmcne...@invisible.ca>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.105 2023/07/10 07:01:48 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_machdep.c,v 1.106 2023/08/04 09:06:33 mrg Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_bootconfig.h"
@@ -407,7 +407,7 @@ initarm(void *arg)
 	extern char const __start__init_memory[];
 	extern char const __stop__init_memory[] __weak;
 
-	if (__start__init_memory != __stop__init_memory) {
+	if (&__start__init_memory[0] != &__stop__init_memory[0]) {
 		const paddr_t spa = KERN_VTOPHYS((vaddr_t)__start__init_memory);
 		const paddr_t epa = KERN_VTOPHYS((vaddr_t)__stop__init_memory);
 		const paddr_t spg = atop(spa);

Index: src/sys/arch/riscv/riscv/riscv_machdep.c
diff -u src/sys/arch/riscv/riscv/riscv_machdep.c:1.31 src/sys/arch/riscv/riscv/riscv_machdep.c:1.32
--- src/sys/arch/riscv/riscv/riscv_machdep.c:1.31	Mon Jul 10 07:04:20 2023
+++ src/sys/arch/riscv/riscv/riscv_machdep.c	Fri Aug  4 09:06:33 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: riscv_machdep.c,v 1.31 2023/07/10 07:04:20 rin Exp $	*/
+/*	$NetBSD: riscv_machdep.c,v 1.32 2023/08/04 09:06:33 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2014, 2019, 2022 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #include "opt_riscv_debug.h"
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: riscv_machdep.c,v 1.31 2023/07/10 07:04:20 rin Exp $");
+__RCSID("$NetBSD: riscv_machdep.c,v 1.32 2023/08/04 09:06:33 mrg Exp $");
 
 #include <sys/param.h>
 
@@ -584,7 +584,7 @@ cpu_kernel_vm_init(paddr_t memory_start,
 	 */
 	extern char const __start__init_memory[];
 	extern char const __stop__init_memory[] __weak;
-	if (__start__init_memory != __stop__init_memory) {
+	if (&__start__init_memory[0] != &__stop__init_memory[0]) {
 		const paddr_t spa = KERN_VTOPHYS((vaddr_t)__start__init_memory);
 		const paddr_t epa = KERN_VTOPHYS((vaddr_t)__stop__init_memory);
 

Reply via email to