[Bug sanitizer/81870] -fsanitize=undefined doesn't pay attention to __builtin_assume_aligned()
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Aug 17 10:04:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81870
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Petr from comment #2)
> 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.
__builtin_assume_aligned cannot be used to decrease alignment or make unaligned
accesses valid. I didn't know __assume_aligned by Intel and MS does that.
More information about the Gcc-bugs
mailing list