#include <stdio.h> #include <stdint.h> #include <inttypes.h> int main() { void *p=(void *)0x80000000; printf( "%p" "\n", p );// 0x80000000 printf("0x%" PRIxPTR "\n", (uintptr_t)p );// 0x80000000 printf("0x%" PRIx64 "\n",reinterpret_cast<uint64_t>(p));// 0xffffffff80000000 printf("0x%" PRIx64 "\n", (uint64_t) p );// 0xffffffff80000000 printf("0x%" PRIx64 "\n", (uint64_t)(uintptr_t)p );// 0x80000000 } gcc-9.2.1-1.fc30.x86_64 g++ -o addr_t2 addr_t2.cpp -Wall -g -m32 0x80000000 0x80000000 0xffffffff80000000 0xffffffff80000000 0x80000000 clang-8.0.0-3.fc30.x86_64 clang++ -o addr_t2 addr_t2.cpp -Wall -g -m32 ;./addr_t2 0x80000000 0x80000000 0x80000000 0x80000000 0x80000000 It may be in some standard but it looks suspicious to me.
https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Arrays-and-pointers-implementation.html#Arrays-and-pointers-implementation
This is implementation defined area. And is documented. Neither is clang or gcc is wrong. Now I dont know where clang it is documented but I posted where gcc behavior is documented. So closing as invalid.
.
Thanks.