git: f7f9a033f3ec - main - rtld: quiet gcc -Wrestrict

From: Ryan Libby <rlibby_at_FreeBSD.org>
Date: Sun, 07 Jul 2024 23:47:24 UTC
The branch main has been updated by rlibby:

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

commit f7f9a033f3ec755c8f1657103ba083294eb155d4
Author:     Ryan Libby <rlibby@FreeBSD.org>
AuthorDate: 2024-07-07 23:46:49 +0000
Commit:     Ryan Libby <rlibby@FreeBSD.org>
CommitDate: 2024-07-07 23:46:49 +0000

    rtld: quiet gcc -Wrestrict
    
    Reported by:    GCC -Wrestrict
    Reviewed by:    kib
    Differential Revision:  https://reviews.freebsd.org/D45892
---
 lib/libthr/thread/thr_rtld.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/libthr/thread/thr_rtld.c b/lib/libthr/thread/thr_rtld.c
index 54560a2f7df2..25ecb83a11a3 100644
--- a/lib/libthr/thread/thr_rtld.c
+++ b/lib/libthr/thread/thr_rtld.c
@@ -220,19 +220,19 @@ _thr_rtld_init(void)
 	struct RtldLockInfo	li;
 	struct pthread		*curthread;
 	ucontext_t *uc;
-	long dummy = -1;
 	int uc_len;
+	char dummy[2] = {};
 
 	curthread = _get_curthread();
 
 	/* force to resolve _umtx_op PLT */
-	_umtx_op_err((struct umtx *)&dummy, UMTX_OP_WAKE, 1, 0, 0);
+	_umtx_op_err(&dummy, UMTX_OP_WAKE, 1, 0, 0);
 	
 	/* force to resolve errno() PLT */
 	__error();
 
 	/* force to resolve memcpy PLT */
-	memcpy(&dummy, &dummy, sizeof(dummy));
+	memcpy(&dummy[0], &dummy[1], 1);
 
 	mprotect(NULL, 0, 0);
 	_rtld_get_stack_prot();