git: e67b246734e3 - main - libzpool: Disable -Wuse-after-free for dbuf.c.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Mon, 03 Oct 2022 23:11:25 UTC
The branch main has been updated by jhb:

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

commit e67b246734e37d1128fae0faecdd37806c5328ed
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-10-03 23:10:43 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-10-03 23:10:43 +0000

    libzpool: Disable -Wuse-after-free for dbuf.c.
    
    The debug traces for reference counting in ZFS use the pointer of the
    owning object as a "tag" for references to check that when an object
    drops a reference it had actually held one.  In a couple of places ZFS
    drops references after freeing the owning object.  In userland GCC
    realizes this is a use after free.  However, since only the value of
    the pointer is used, and it isn't indirected, the use is harmless.
    
    Reviewed by:    emaste
    Differential Revision:  https://reviews.freebsd.org/D36818
---
 cddl/lib/libzpool/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/cddl/lib/libzpool/Makefile b/cddl/lib/libzpool/Makefile
index b9ef6575c99a..13671752fe88 100644
--- a/cddl/lib/libzpool/Makefile
+++ b/cddl/lib/libzpool/Makefile
@@ -286,6 +286,10 @@ CSTD=	c99
 
 CFLAGS+=	-g -DDEBUG=1
 
+# Pointer values are used as debugging "tags" to mark reference count
+# ownerships and in some cases the tag reference is dropped after an
+# object is freed.
+CFLAGS.dbuf.c=			${NO_WUSE_AFTER_FREE}
 CFLAGS.entropy_common.c=	-fno-tree-vectorize
 CFLAGS.entropy_common.c+=	${NO_WBITWISE_INSTEAD_OF_LOGICAL}
 CFLAGS.error_private.c=		-fno-tree-vectorize