Re: -current build failure
--c5s4KQzYKKhDo6IA
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Sat, Jul 21, 2012 at 04:00:45PM -0400, Kim Culhan wrote:
> On Fri, Jul 20, 2012 at 11:40 AM, Dimitry Andric <dim@freebsd.org> wrote:
> > On 2012-07-20 16:49, Kim Culhan wrote:
> >> Seeing this for r:238655
> > ...
> >> In file included from /usr/src/sys/modules/dtrace/dtrace/../../../sys/=
pcpu.h:44:
> >> ./machine/pcpu.h:226:13: error: indirection of non-volatile null
> >> pointer will be deleted, not trap
> >> [-Werror,-Wnull-dereference]
> >> : "m" (*(char *)OFFSETOF_CURTHREAD));
> >> ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> >> ./machine/pcpu.h:226:13: note: consider using __builtin_trap() or
> >> qualifying pointer with 'volatile'
> >
> > That's indeed a valid warning from clang, since OFFSETOF_CURTHREAD is
> > usually zero. It's probably due to recent work on dtrace. I'm not in
> > the neighborhood of a FreeBSD box right now to verify, but can you
> > please try to change the cast to "(volatile char *)"? That should fix
> > the warning.
>=20
> Yes it did, I know there are many considerations wrt to this warning.
This should be equivalent to what you tried. Can you test build and
boot resulting kernel with this patch ?
diff --git a/sys/amd64/include/pcpu.h b/sys/amd64/include/pcpu.h
index 5d1fd4d..7b3c934 100644
--- a/sys/amd64/include/pcpu.h
+++ b/sys/amd64/include/pcpu.h
@@ -217,16 +217,22 @@ extern struct pcpu *pcpup;
#define PCPU_SET(member, val) __PCPU_SET(pc_ ## member, val)
=20
#define OFFSETOF_CURTHREAD 0
+#ifdef __clang__
+#define VOLATILE volatile
+#else
+#define VOLATILE
+#endif
static __inline __pure2 struct thread *
__curthread(void)
{
struct thread *td;
=20
__asm("movq %%gs:%1,%0" : "=3Dr" (td)
- : "m" (*(char *)OFFSETOF_CURTHREAD));
+ : "m" (*(VOLATILE char *)OFFSETOF_CURTHREAD));
return (td);
}
#define curthread (__curthread())
+#undef VOLATILE
=20
#define OFFSETOF_CURPCB 32
static __inline __pure2 struct pcb *
--c5s4KQzYKKhDo6IA
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (FreeBSD)
iEYEARECAAYFAlALHCwACgkQC3+MBN1Mb4j0PACdEeKWFT3hrlscAx7F83QbwlII
j2kAnREWLKZ9UJnpR0OJNPB5M9+NS0KM
=EP8K
-----END PGP SIGNATURE-----
--c5s4KQzYKKhDo6IA--
討論串 (同標題文章)
完整討論串 (本文為第 12 之 21 篇):