git: 7523a37f68ec - stable/14 - Fix build with gcc12.

From: Navdeep Parhar <np_at_FreeBSD.org>
Date: Tue, 31 Oct 2023 17:43:56 UTC
The branch stable/14 has been updated by np:

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

commit 7523a37f68ec31b9268d0efe93c5920add3ad8c0
Author:     Navdeep Parhar <np@FreeBSD.org>
AuthorDate: 2023-10-27 23:39:12 +0000
Commit:     Navdeep Parhar <np@FreeBSD.org>
CommitDate: 2023-10-31 15:59:28 +0000

    Fix build with gcc12.
    
    (cherry picked from commit c656f5c1a6f8482f24a5a716267311c3e62b3114)
---
 sys/fs/ext2fs/ext2_inode.c | 6 ++++++
 sys/ufs/ffs/ffs_inode.c    | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/sys/fs/ext2fs/ext2_inode.c b/sys/fs/ext2fs/ext2_inode.c
index 3ab566ee53fc..2c1cf9736fb5 100644
--- a/sys/fs/ext2fs/ext2_inode.c
+++ b/sys/fs/ext2fs/ext2_inode.c
@@ -232,7 +232,9 @@ ext2_ind_truncate(struct vnode *vp, off_t length, int flags, struct ucred *cred,
 	struct inode *oip;
 	e4fs_daddr_t bn, lbn, lastiblock[EXT2_NIADDR], indir_lbn[EXT2_NIADDR];
 	uint32_t oldblks[EXT2_NDADDR + EXT2_NIADDR];
+#ifdef INVARIANTS
 	uint32_t newblks[EXT2_NDADDR + EXT2_NIADDR];
+#endif
 	struct m_ext2fs *fs;
 	struct buf *bp;
 	int offset, size, level;
@@ -348,11 +350,15 @@ ext2_ind_truncate(struct vnode *vp, off_t length, int flags, struct ucred *cred,
 	 * when we are done.
 	 */
 	for (i = 0; i < EXT2_NDADDR; i++) {
+#ifdef INVARIANTS
 		newblks[i] = oip->i_db[i];
+#endif
 		oip->i_db[i] = oldblks[i];
 	}
 	for (i = 0; i < EXT2_NIADDR; i++) {
+#ifdef INVARIANTS
 		newblks[EXT2_NDADDR + i] = oip->i_ib[i];
+#endif
 		oip->i_ib[i] = oldblks[EXT2_NDADDR + i];
 	}
 	oip->i_size = osize;
diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c
index fb6e8dfb2f76..8ecd37e694e8 100644
--- a/sys/ufs/ffs/ffs_inode.c
+++ b/sys/ufs/ffs/ffs_inode.c
@@ -238,7 +238,9 @@ ffs_truncate(struct vnode *vp,
 	struct inode *ip;
 	ufs2_daddr_t bn, lbn, lastblock, lastiblock[UFS_NIADDR];
 	ufs2_daddr_t indir_lbn[UFS_NIADDR], oldblks[UFS_NDADDR + UFS_NIADDR];
+#ifdef INVARIANTS
 	ufs2_daddr_t newblks[UFS_NDADDR + UFS_NIADDR];
+#endif
 	ufs2_daddr_t count, blocksreleased = 0, blkno;
 	struct bufobj *bo __diagused;
 	struct fs *fs;
@@ -546,11 +548,15 @@ ffs_truncate(struct vnode *vp,
 	 * when we are done.
 	 */
 	for (i = 0; i < UFS_NDADDR; i++) {
+#ifdef INVARIANTS
 		newblks[i] = DIP(ip, i_db[i]);
+#endif
 		DIP_SET(ip, i_db[i], oldblks[i]);
 	}
 	for (i = 0; i < UFS_NIADDR; i++) {
+#ifdef INVARIANTS
 		newblks[UFS_NDADDR + i] = DIP(ip, i_ib[i]);
+#endif
 		DIP_SET(ip, i_ib[i], oldblks[UFS_NDADDR + i]);
 	}
 	ip->i_size = osize;