public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98641] New: Feature request: implement pointer alignment builtins
@ 2021-01-12 17:01 ktkachov at gcc dot gnu.org
  2021-01-12 17:02 ` [Bug c++/98641] " ktkachov at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: ktkachov at gcc dot gnu.org @ 2021-01-12 17:01 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-01-13 14:31 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-12 17:01 [Bug c++/98641] New: Feature request: implement pointer alignment builtins ktkachov at gcc dot gnu.org
2021-01-12 17:02 ` [Bug c++/98641] " ktkachov at gcc dot gnu.org
2021-01-13  8:11 ` rguenth at gcc dot gnu.org
2021-01-13 10:07 ` redi at gcc dot gnu.org
2021-01-13 10:18 ` jakub at gcc dot gnu.org
2021-01-13 10:21 ` redi at gcc dot gnu.org
2021-01-13 12:44 ` Alexander.Richardson at cl dot cam.ac.uk
2021-01-13 12:53 ` Alexander.Richardson at cl dot cam.ac.uk
2021-01-13 12:54 ` jakub at gcc dot gnu.org
2021-01-13 14:31 ` Alexander.Richardson at cl dot cam.ac.uk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).