This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug sanitizer/81870] -fsanitize=undefined doesn't pay attention to __builtin_assume_aligned()
- From: "kobalicek.petr at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 16 Aug 2017 21:19:56 +0000
- Subject: [Bug sanitizer/81870] -fsanitize=undefined doesn't pay attention to __builtin_assume_aligned()
- Auto-submitted: auto-generated
- References: <bug-81870-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81870
--- Comment #2 from Petr <kobalicek.petr at gmail dot com> ---
I see, so if I understand it correctly then:
1. `__builtin_assume_aligned()` should be used to promote the type to a higher
than natural alignment, for example 16 bytes for easier auto-vectorization.
2. `__attribute__((aligned(N)))` should be used to relax alignment of native
types to lower than natural alignment.
It's interesting that with `__builtin_assume_aligned()` I achieved basically
the same effect as with `__attribute__((aligned(N))`, just the sanitizer is not
happy.
Interestingly, I thought that __builtin_assume_aligned() is basically
equivalent to `__assume_aligned()` provided by Intel and MS compilers.
Anyway thanks for your answer, I need to fix my code a bit.