Date: Tue, 21 Feb 2017 21:59:47 +0100 From: "Piotr P. Stefaniak" <pstef@freebsd.org> To: Bruce Evans <brde@optusnet.com.au> Cc: Conrad Meyer <cem@freebsd.org>, "Pedro F. Giffuni" <pfg@freebsd.org>, src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r313982 - in head/sys/dev: agp al_eth an arcmsr bce beri/virtio bhnd/cores/usb buslogic ce cm cp ctau cx de ed fatm fe firewire hptiop hptmv iicbus isp le md ncr netmap ofw patm pccard ... Message-ID: <20170221205947.GG87692@freefall.freebsd.org> In-Reply-To: <20170221234517.L3157@besplex.bde.org> References: <201702200343.v1K3hCk3060716@repo.freebsd.org> <CAG6CVpUSxaQkq%2B7siKQPOW4FuaVpoY5uMcSb6jMvrROqSiqzGA@mail.gmail.com> <20170221234517.L3157@besplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --]
On 2017-02-22 00:46:31, Bruce Evans wrote:
>On Mon, 20 Feb 2017, Conrad Meyer wrote:
>> Maybe this is moot. I don't believe any architecture FreeBSD actually
>> supports has non-zero bitpattern NULL, but something weird like CHERI
>> might.
>
>Compilers should do portability checks on it. In fact, the convolutions
>in this file do little except define nullptr and __null to let compilers
>do more checking. Only the C++ case even has them. Compilers can do
>most checks using just the C90 definition of null pointer constants.
tcc(1) of the TenDRA project can set the null pointer representation to
0x55555555 via -f option of trans(1) (but only on x86):
$ cat test.c
#include <stdio.h>
int main(void)
{
char *x = NULL;
unsigned long int y = (unsigned long int)x;
printf("%lx\n", y);
return 0;
}
$ tcc ./test.c -o test
$ ./test
0
$ tcc -Wt,f ./test.c -o test
$ ./test
55555555
See http://www.tendra.org/trans.1/ for more details.
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
iQEzBAEBCAAdFiEElaLNZulp/QcHQR2KSnkqwcVL7lkFAlisqjEACgkQSnkqwcVL
7lng3Af/QsjDNjA/K1M1EOkvUqNgU0iOD6fkMk4brIkBUjXQnfp4r4hmZVy2nYxN
X3bsJEzyNMm5Wv0U9S5sXDqCp9+kYbEJICHFEnbf4u/LbNMyf4D/3BRdx/dboXm7
AbaTMFiXmJ4/udjpYVJbaJnUxOgK4Ys820aN2zlt0IIXsy3VLYk+h9Je/avuXBGA
FbLjGsmDe2jCdDarLuoSmJ0dxR4qkr5/nI+ROm0DwgIPaLYQUkndaq6Ovm2L6fx5
0sGbGlT1mFMAZkozlnhFeXdHvmEKHq6qgYgrxxXCYShTV/nURYYffeNReuJxA1Ii
kv4Fu0AUrf2FV105cj7AwaeZO9a5oA==
=Fnpe
-----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170221205947.GG87692>
