Skip to content

Commit 14a868b

Browse files
committed
Fix phpGH-11514: PHP 8.3 build fails with --enable-mbstring enabled
I tweaked the #if check such that the workaround only applies on GCC versions older than 8.0. I tested this with GCC 7.5, 8.4, 9.4, GCC 13.1.1, and Clang 10.0. Closes phpGH-11516.
1 parent 3c184b6 commit 14a868b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

NEWS

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ PHP NEWS
1212

1313
- MBString:
1414
. Implement mb_str_pad() RFC. (nielsdos)
15+
. Fixed bug GH-11514 (PHP 8.3 build fails with --enable-mbstring enabled).
16+
(nielsdos)
1517

1618
22 Jun 2023, PHP 8.3.0alpha2
1719

ext/mbstring/mbstring.c

+6
Original file line numberDiff line numberDiff line change
@@ -4981,6 +4981,12 @@ static void init_check_utf8(void)
49814981

49824982
#if defined(ZEND_INTRIN_AVX2_NATIVE) || defined(ZEND_INTRIN_AVX2_RESOLVER)
49834983

4984+
/* GCC prior to version 8 does not define all intrinsics. See GH-11514.
4985+
* Use a workaround from https://stackoverflow.com/questions/32630458/setting-m256i-to-the-value-of-two-m128i-values */
4986+
#if defined(__GNUC__) && !defined(__llvm__) && !defined(__INTEL_COMPILER) && __GNUC__ < 8
4987+
# define _mm256_set_m128i(v0, v1) _mm256_insertf128_si256(_mm256_castsi128_si256(v1), (v0), 1)
4988+
#endif
4989+
49844990
/* Take (256-bit) `hi` and `lo` as a 512-bit value, shift down by some
49854991
* number of bytes, then take the low 256 bits
49864992
* This is used to take some number of trailing bytes from the previous 32-byte

0 commit comments

Comments
 (0)