From 082a394dd045032be2a973d1bf06336c5773f268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Zaoral?= Date: Tue, 3 Feb 2026 14:04:28 +0100 Subject: [PATCH] fix ppc64le test failures Resolves: RHEL-77878 --- fix-ppc64le-power10-test-failures.patch | 47 +++++++++++++++++++++++++ numpy.spec | 7 +++- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 fix-ppc64le-power10-test-failures.patch diff --git a/fix-ppc64le-power10-test-failures.patch b/fix-ppc64le-power10-test-failures.patch new file mode 100644 index 0000000..80fdd9b --- /dev/null +++ b/fix-ppc64le-power10-test-failures.patch @@ -0,0 +1,47 @@ +From e89ec589000e471f04c71b676c866baec05ecd7d Mon Sep 17 00:00:00 2001 +From: Sandeep Gupta +Date: Thu, 9 Oct 2025 22:42:35 +0530 +Subject: [PATCH] BUG: Fix INT_MIN % -1 to return 0 for all signed integer + types (#29893) + +* BUG: Fix INT_MIN % -1 to return 0 for all signed integer types + +- Explicitly check for INT_MIN % -1 in scalar tail loops for fmod and remainder kernels. +- Set result to 0 to avoid undefined behavior and match NumPy/Python expectations. +- Ensures correct, portable behavior on all platforms (e.g., PPC64LE). + +* Apply suggestion from @seberg + +--------- + +Co-authored-by: Sebastian Berg +--- + numpy/_core/src/umath/loops_modulo.dispatch.c.src | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/numpy/core/src/umath/loops_modulo.dispatch.c.src b/numpy/core/src/umath/loops_modulo.dispatch.c.src +index 032cc3344060..4645fe14a487 100644 +--- a/numpy/core/src/umath/loops_modulo.dispatch.c.src ++++ b/numpy/core/src/umath/loops_modulo.dispatch.c.src +@@ -490,12 +490,16 @@ vsx4_simd_@func@_by_scalar_contig_@sfx@(char **args, npy_intp len) + #else /* fmod and remainder */ + for (; len > 0; --len, ++src1, ++dst1) { + const npyv_lanetype_@sfx@ a = *src1; +- *dst1 = a % scalar; ++ if (NPY_UNLIKELY(a == NPY_MIN_INT@len@ && scalar == -1)) { ++ *dst1 = 0; ++ } else { ++ *dst1 = a % scalar; + #if @id@ == 1 /* remainder */ +- if (!((a > 0) == (scalar > 0) || *dst1 == 0)) { +- *dst1 += scalar; +- } ++ if (!((a > 0) == (scalar > 0) || *dst1 == 0)) { ++ *dst1 += scalar; ++ } + #endif ++ } + } + #endif + npyv_cleanup(); + diff --git a/numpy.spec b/numpy.spec index db2f06c..1220072 100644 --- a/numpy.spec +++ b/numpy.spec @@ -20,7 +20,7 @@ Name: numpy Version: 1.26.4 -Release: 5%{?dist} +Release: 6%{?dist} Epoch: 1 Summary: A fast multidimensional array facility for Python @@ -38,6 +38,8 @@ Patch0: f2py_test.patch # Python 3.13: Replace deprecated ctypes.ARRAY(item_type, size) with item_type * size # Upstream PR: https://github.com/numpy/numpy/pull/25198 Patch4: replace-deprecated-ctypes.ARRAY.patch +# https://github.com/numpy/numpy/commit/e89ec589000e471f04c71b676c866baec05ecd7d +Patch5: fix-ppc64le-power10-test-failures.patch %description @@ -245,6 +247,9 @@ python3 runtests.py --no-build -- -ra -k 'not test_ppc64_ibm_double_double128 %{ %changelog +* Tue Feb 03 2026 Lukáš Zaoral - 1:1.26.4-6 +- fix ppc64le test failures (RHEL-77878) + * Tue Oct 29 2024 Troy Dawson - 1:1.26.4-5 - Bump release for October 2024 mass rebuild: Resolves: RHEL-64018