https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116481
Richard Sandiford <rsandifo at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rsandifo at gcc dot gnu.org --- Comment #9 from Richard Sandiford <rsandifo at gcc dot gnu.org> --- (In reply to Bruno Haible from comment #7) > Thanks for the attempted advice. But, no, converting a pointer to uintptr_t > and later back to a pointer is bad for portability: It does not work on the > CHERI architecture and its implementation on the ARM Morello chip > https://developer.arm.com/Architectures/Morello, because it loses the tag > bits that are essential for accessing the pointer. See > https://www.gnu.org/software/gnulib/manual/html_node/C99-features-avoided. > html and https://lists.gnu.org/archive/html/bug-gnulib/2023-12/msg00021.html > . I think Richard's point still stands though. Conversion to and from (u)intptr_t does not in itself drop the tag bit. CHERI/Morello (u)intptr_t can hold exactly what a void* can hold. If the tag bit is dropped by going out of bounds, that's a feature, not a bug, and would happen equally for void*/char* arithmetic as for (u)intptr_t arithmetic.