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 ...

Piotr P. Stefaniak pstef at freebsd.org
Tue Feb 21 20:59:48 UTC 2017


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.freebsd.org/pipermail/svn-src-all/attachments/20170221/c1fd670d/attachment.sig>


More information about the svn-src-all mailing list