[openssl-dev] [openssl.org #4475] PATCH: fix cast-alignment of "struct lhash_st *"

noloader@gmail.com via RT rt at openssl.org
Thu Mar 24 18:35:38 UTC 2016


This clears what looks to be hundreds of alignment related warnings like below.

$ git diff include/openssl/lhash.h
diff --git a/include/openssl/lhash.h b/include/openssl/lhash.h
index 2edd738..5da5054 100644
--- a/include/openssl/lhash.h
+++ b/include/openssl/lhash.h
@@ -180,7 +180,7 @@ void lh_node_usage_stats_bio(const _LHASH *lh, BIO *out);
 # define LHASH_OF(type) struct lhash_st_##type

 # define DEFINE_LHASH_OF(type) \
-    LHASH_OF(type) { int dummy; }; \
+    LHASH_OF(type) { unsigned long dummy; }; \
     static ossl_inline LHASH_OF(type) * \
         lh_##type##_new(unsigned long (*hfn)(const type *), \
                         int (*cfn)(const type *, const type *)) \

**********

cc -DDSO_DLFCN -DHAVE_DLFCN_H -DOPENSSL_THREADS
-DOPENSSL_NO_DYNAMIC_ENGINE -DOPENSSL_PIC -DOPENSSL_IA32_SSE2
-DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m
-DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM
-DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DNDEBUG
-DOPENSSLDIR="\"/usr/local/ssl\""
-DENGINESDIR="\"/usr/local/lib/engines\"" -O3 -D_REENTRANT -arch
x86_64 -DL_ENDIAN -Wall  -g2 -O3 -Wcast-align -fPIC -Iinclude -I.
-Icrypto/include -MMD -MF crypto/aes/aes_ige.d.tmp -MT
crypto/aes/aes_ige.o -c -o crypto/aes/aes_ige.o crypto/aes/aes_ige.c
In file included from crypto/aes/aes_ige.c:51:
In file included from crypto/include/internal/cryptlib.h:74:
In file included from include/openssl/err.h:123:
include/openssl/lhash.h:265:1: warning: cast from 'struct
      lhash_st_OPENSSL_STRING *' to '_LHASH *' (aka 'struct lhash_st *')
      increases required alignment from 4 to 8 [-Wcast-align]
DEFINE_LHASH_OF(OPENSSL_STRING);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/openssl/lhash.h:193:17: note: expanded from macro 'DEFINE_LHASH_OF'
        lh_free((_LHASH *)lh); \
                ^~~~~~~~~~~~
include/openssl/lhash.h:265:1: warning: cast from 'struct
      lhash_st_OPENSSL_STRING *' to '_LHASH *' (aka 'struct lhash_st *')
      increases required alignment from 4 to 8 [-Wcast-align]
DEFINE_LHASH_OF(OPENSSL_STRING);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/openssl/lhash.h:197:34: note: expanded from macro 'DEFINE_LHASH_OF'
        return (type *)lh_insert((_LHASH *)lh, d); \
                                 ^~~~~~~~~~~~


-- 
Ticket here: http://rt.openssl.org/Ticket/Display.html?id=4475
Please log in as guest with password guest if prompted



More information about the openssl-dev mailing list