From 434e83c13a02b7429264750bce2ac211fe5aaa2b Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Tue, 26 May 2026 11:02:32 +0200 Subject: [PATCH] [GR-75861] Avoid NumPy maybe-uninitialized Werror --- .../lib-graalpython/patches/numpy-2.0.0.patch | 15 ++++++++++++ .../lib-graalpython/patches/numpy-2.4.4.patch | 23 +++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/graalpython/lib-graalpython/patches/numpy-2.0.0.patch b/graalpython/lib-graalpython/patches/numpy-2.0.0.patch index 5d927746d4..5286a611cf 100644 --- a/graalpython/lib-graalpython/patches/numpy-2.0.0.patch +++ b/graalpython/lib-graalpython/patches/numpy-2.0.0.patch @@ -11,6 +11,21 @@ index 0462625..3625e34 100644 /* * On PyPy, dictionary keys do not always preserve object identity. * Fall back to comparison by value. +diff --git a/numpy/_core/meson.build b/numpy/_core/meson.build +index d32d71a..7767221 100644 +--- a/numpy/_core/meson.build ++++ b/numpy/_core/meson.build +@@ -810,2 +810,5 @@ endforeach + # ----------------------------------- ++# GraalPy change: GCC 12 can report a false positive maybe-uninitialized ++# warning in AVX512 intrinsics used by x86-simd-sort. Some CI builds use Werror. ++combined_cpp_args = cpp_args_common + max_opt + cpp.get_supported_arguments('-Wno-error=maybe-uninitialized') + foreach gen_mtargets : [ +@@ -848,3 +851,3 @@ foreach gen_mtargets : [ + c_args: c_args_common + max_opt, +- cpp_args: cpp_args_common + max_opt, ++ cpp_args: combined_cpp_args, + include_directories: [ diff --git a/numpy/_core/src/multiarray/compiled_base.c b/numpy/_core/src/multiarray/compiled_base.c index 7913b18..9463852 100644 --- a/numpy/_core/src/multiarray/compiled_base.c diff --git a/graalpython/lib-graalpython/patches/numpy-2.4.4.patch b/graalpython/lib-graalpython/patches/numpy-2.4.4.patch index 8296b9f717..8a18791753 100644 --- a/graalpython/lib-graalpython/patches/numpy-2.4.4.patch +++ b/graalpython/lib-graalpython/patches/numpy-2.4.4.patch @@ -11,6 +11,29 @@ index 6bfc40f..046ff74 100644 /* * On PyPy, dictionary keys do not always preserve object identity. * Fall back to comparison by value. +diff --git a/numpy/_core/meson.build b/numpy/_core/meson.build +index 3a0b52c..1819ec6 100644 +--- a/numpy/_core/meson.build ++++ b/numpy/_core/meson.build +@@ -854,6 +854,9 @@ endforeach + + # Build npysort dispatch-able sources + # ----------------------------------- ++# GraalPy change: GCC 12 can report a false positive maybe-uninitialized ++# warning in AVX512 intrinsics used by x86-simd-sort. Some CI builds use Werror. ++combined_cpp_args = cpp_args_common + max_opt + cpp.get_supported_arguments('-Wno-error=maybe-uninitialized') + foreach gen_mtargets : [ + [ + 'x86_simd_argsort.dispatch.h', +@@ -897,7 +900,7 @@ foreach gen_mtargets : [ + prefix: 'NPY_', + dependencies: [py_dep, np_core_dep, omp_dep], + c_args: c_args_common + max_opt, +- cpp_args: cpp_args_common + max_opt, ++ cpp_args: combined_cpp_args, + include_directories: [ + 'include', + 'src/common', diff --git a/numpy/_core/src/multiarray/compiled_base.c b/numpy/_core/src/multiarray/compiled_base.c index 6e37968..010bd03 100644 --- a/numpy/_core/src/multiarray/compiled_base.c