[PATCH] pointer to integer conversion.

2013-11-23 Thread Iain Buclaw
Hi, This is a one line patch to an unexpected behaviour noticed from ARM and x86 when testing the D frontend. --- import core.stdc.stdio; import core.stdc.stdint; void test(void* p) { uint64_t pl = cast(uint64_t)p; uint64_t p2 = cast(uint64_t)cast(int)p; int tmp = cast(int)p;

Re: [PATCH] pointer to integer conversion.

2013-11-23 Thread Andreas Schwab
Iain Buclaw ibuc...@gdcproject.org writes: Currently, GCC is converting the expression to a signed integer instead of an unsigned one. Does a test for the testsuite need to be written for this? The C standard makes this implementation-defined, and GCC defines it like this (*Note (gcc) Arrays

Re: [PATCH] pointer to integer conversion.

2013-11-23 Thread Iain Buclaw
On 23 November 2013 10:46, Andreas Schwab sch...@linux-m68k.org wrote: Iain Buclaw ibuc...@gdcproject.org writes: Currently, GCC is converting the expression to a signed integer instead of an unsigned one. Does a test for the testsuite need to be written for this? The C standard makes this

Re: [PATCH] pointer to integer conversion.

2013-11-23 Thread Ian Lance Taylor
On Sat, Nov 23, 2013 at 4:38 AM, Iain Buclaw ibuc...@gdcproject.org wrote: OK, I've checked that document, and there's also a comment with it. Apparently someone spotted this before. @c ??? We've always claimed that pointers were unsigned entities. @c Shouldn't we therefore be doing