Date: Wed, 3 Jul 2024 16:14:58 GMT From: Ryan Libby <rlibby@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 657b1276ad4c - main - libthr _get_curthread amd64: quiet gcc -Warray-bounds Message-ID: <202407031614.463GEwuc041619@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by rlibby: URL: https://cgit.FreeBSD.org/src/commit/?id=657b1276ad4c2d2d92ce9d13b338349c0fa40dc3 commit 657b1276ad4c2d2d92ce9d13b338349c0fa40dc3 Author: Ryan Libby <rlibby@FreeBSD.org> AuthorDate: 2024-07-03 15:37:11 +0000 Commit: Ryan Libby <rlibby@FreeBSD.org> CommitDate: 2024-07-03 15:37:11 +0000 libthr _get_curthread amd64: 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 fs segment. Otherwise gcc complains if we tell it we are reading memory offset 0x10. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D45828 --- lib/libthr/arch/amd64/include/pthread_md.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libthr/arch/amd64/include/pthread_md.h b/lib/libthr/arch/amd64/include/pthread_md.h index f43578a8241a..995f35cb569c 100644 --- a/lib/libthr/arch/amd64/include/pthread_md.h +++ b/lib/libthr/arch/amd64/include/pthread_md.h @@ -47,8 +47,8 @@ _get_curthread(void) { struct pthread *thr; - __asm __volatile("movq %%fs:%1, %0" : "=r" (thr) - : "m" (*(volatile u_long *)offsetof(struct tcb, tcb_thread))); + __asm __volatile("movq %%fs:%c1, %0" : "=r" (thr) + : "i" (offsetof(struct tcb, tcb_thread))); return (thr); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202407031614.463GEwuc041619>