From: Nikita Popov Date: Fri, 12 Apr 2019 13:10:17 +0000 (+0200) Subject: Remove dubious memcmp optimization in iconv X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1b419616369e7492688a8b60e5045005a4647423;p=php Remove dubious memcmp optimization in iconv This violates strict aliasing, and appears entirely unnecessary -- the compiler can optimize fixed size memcmp's by itself. --- diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index 0e85a5c3b3..62f7cb3af1 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -55,7 +55,7 @@ #include "ext/standard/quot_print.h" #define _php_iconv_memequal(a, b, c) \ - ((c) == sizeof(zend_ulong) ? *((zend_ulong *)(a)) == *((zend_ulong *)(b)) : ((c) == sizeof(unsigned int) ? *((unsigned int *)(a)) == *((unsigned int *)(b)) : memcmp(a, b, c) == 0)) + (memcmp(a, b, c) == 0) /* {{{ arginfo */ ZEND_BEGIN_ARG_INFO_EX(arginfo_iconv_strlen, 0, 0, 1)