[PATCH 1/7] bufhelp: add 'may_alias' attribute for properly aligned 'bufhelp_int_t'

Jussi Kivilinna jussi.kivilinna at iki.fi
Wed Jan 25 22:15:10 CET 2017


* cipher/bufhelp.h [!BUFHELP_FAST_UNALIGNED_ACCESS]
(bufhelp_int_t): Add 'may_alias' attribute.
--

Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
 0 files changed

diff --git a/cipher/bufhelp.h b/cipher/bufhelp.h
index 3616515..1c52db5 100644
--- a/cipher/bufhelp.h
+++ b/cipher/bufhelp.h
@@ -49,11 +49,18 @@ typedef struct bufhelp_int_s
 /* Define type with default alignment for other architectures (unaligned
    accessed handled in per byte loops).
  */
+#ifdef HAVE_GCC_ATTRIBUTE_MAY_ALIAS
+typedef struct bufhelp_int_s
+{
+  uintptr_t a;
+} __attribute__((may_alias)) bufhelp_int_t;
+#else
 typedef struct bufhelp_int_s
 {
   uintptr_t a;
 } bufhelp_int_t;
 #endif
+#endif
 
 
 /* Optimized function for small buffer copying */




More information about the Gcrypt-devel mailing list