You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/app-crypt/md5deep/files/md5deep-4.2-strict-aliasing...

25 lines
870 B

--- trunk/src/md5.c 2012/01/05 22:57:35 577
+++ trunk/src/md5.c 2012/07/02 12:34:09 644
@@ -143,8 +143,19 @@
byteReverse(ctx->in, 14);
/* Append length in bits and transform */
- ((uint32_t *) ctx->in)[14] = ctx->bits[0];
- ((uint32_t *) ctx->in)[15] = ctx->bits[1];
+
+ // the two lines below generated this error:
+ // "md5.c:147:5: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]"
+
+ //((uint32_t *) ctx->in)[14] = ctx->bits[0];
+ //((uint32_t *) ctx->in)[15] = ctx->bits[1];
+
+ // We will manually expand the cast into two statements to make
+ // the compiler happy...
+
+ uint32_t *ctxin = (uint32_t *)ctx->in;
+ ctxin[14] = ctx->bits[0];
+ ctxin[15] = ctx->bits[1];
MD5Transform(ctx->buf, (uint32_t *) ctx->in);
byteReverse((unsigned char *) ctx->buf, 4);