[PATCH] hexdump-conv.c: Fix gcc 12 compiler warning

Matthew Joyce matthew.joyce at embedded-brains.de
Tue May 10 11:27:42 UTC 2022


From: Matt Joyce <matthew.joyce at embedded-brains.de>

Fixed newly generated compiler warning introduced in the switch to gcc 12.
gcc 12 adds the new warning -Warray-compare, which warns agains potentially
dubious comparisons between operands of array type.
---
 cpukit/libmisc/shell/hexdump-conv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cpukit/libmisc/shell/hexdump-conv.c b/cpukit/libmisc/shell/hexdump-conv.c
index aa16f9b169..0dee76a595 100644
--- a/cpukit/libmisc/shell/hexdump-conv.c
+++ b/cpukit/libmisc/shell/hexdump-conv.c
@@ -117,7 +117,7 @@ retry:
 		if (clen == 0)
 			clen = 1;
 		else if (clen == (size_t)-1 || (clen == (size_t)-2 &&
-		    buf == peekbuf)) {
+		    &buf[0] == &peekbuf[0])) {
 			memset(&pr->mbstate, 0, sizeof(pr->mbstate));
 			wc = *p;
 			clen = 1;
-- 
2.31.1



More information about the devel mailing list