git: 7b1c770341fe - main - libthr _get_curthread i386: quiet gcc -Warray-bounds
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 03 Jul 2024 16:14:59 UTC
The branch main has been updated by rlibby: URL: https://cgit.FreeBSD.org/src/commit/?id=7b1c770341fe96236772ce3d475e14988833a988 commit 7b1c770341fe96236772ce3d475e14988833a988 Author: Ryan Libby <rlibby@FreeBSD.org> AuthorDate: 2024-07-03 15:37:44 +0000 Commit: Ryan Libby <rlibby@FreeBSD.org> CommitDate: 2024-07-03 15:37:44 +0000 libthr _get_curthread i386: quiet gcc -Warray-bounds Use a constant input operand instead of a bogus memory reference to tell the compiler about offsetof(struct tcb, tcb_thread) in the gs segment. Otherwise gcc complains if we tell it we are reading memory offset 0x8. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D45829 --- lib/libthr/arch/i386/include/pthread_md.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libthr/arch/i386/include/pthread_md.h b/lib/libthr/arch/i386/include/pthread_md.h index 021ce8126909..9008a4f11bdb 100644 --- a/lib/libthr/arch/i386/include/pthread_md.h +++ b/lib/libthr/arch/i386/include/pthread_md.h @@ -47,8 +47,8 @@ _get_curthread(void) { struct pthread *thr; - __asm __volatile("movl %%gs:%1, %0" : "=r" (thr) - : "m" (*(volatile u_int *)offsetof(struct tcb, tcb_thread))); + __asm __volatile("movl %%gs:%c1, %0" : "=r" (thr) + : "i" (offsetof(struct tcb, tcb_thread))); return (thr); }