https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98641
Bug ID: 98641 Summary: Feature request: implement pointer alignment builtins Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ktkachov at gcc dot gnu.org Target Milestone: --- We received reports that users found the pointer alignment builtins provided by LLVM useful in avoiding error-prone casting to and from intptr_t: https://clang.llvm.org/docs/LanguageExtensions.html#alignment-builtins It would be great if we could support them in GCC as well. This would involve implementing: Type __builtin_align_up(Type value, size_t alignment); Type __builtin_align_down(Type value, size_t alignment); bool __builtin_is_aligned(Type value, size_t alignment); Using these builtins the compiler can also preserve pointer provenance information more easily.