https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93269
Bug ID: 93269 Summary: 32bit-pointer to uint64_t cast sign-extends Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: jan.kratochvil at redhat dot com Target Milestone: --- #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.