Compilation "neighbors/_kd_tree.pyx" crashes on ARM

### Describe the bug

Hi. I rebuilt scikit-learn from source, but the compiler crashed.

### Steps/Code to Reproduce

```shell
$ cat /etc/debian_version

12.11
```

```shell
$ cat /etc/os-release

PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
```

```shell
$ gcc --version

gcc (Debian 12.2.0-14+deb12u1) 12.2.0
```

```shell
$ cat requirements | grep scikit
scikit-learn==1.5.2 ; python_version >= "3.12" and python_version < "3.13"

$ pip3 install -r requirements.txt --no-deps --no-binary ":all:" -vvv
```



### Expected Results

Build without problmes

### Actual Results

```
[205/249] Compiling C object sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/meson-generated_sklearn_neighbors__kd_tree.pyx.c.o
  FAILED: sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/meson-generated_sklearn_neighbors__kd_tree.pyx.c.o
  cc -Isklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p -Isklearn/neighbors -I../sklearn/neighbors -I../../../pip-build-env-0jwmo4n5/overlay/lib/python3.12/site-packages/numpy/_core/include -I/usr/local/include/python3.12 -fvisibility=hidden -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c11 -O3 -Wno-unused-but-set-variable -Wno-unused-function -Wno-conversion -Wno-misleading-indentation -fPIC -DNPY_NO_DEPRECATED_API=NPY_1_9_API_VERSION -MD -MQ sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/meson-generated_sklearn_neighbors__kd_tree.pyx.c.o -MF sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/meson-generated_sklearn_neighbors__kd_tree.pyx.c.o.d -o sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/meson-generated_sklearn_neighbors__kd_tree.pyx.c.o -c sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c: In function ‘__pyx_f_7sklearn_9neighbors_8_kd_tree_12BinaryTree64__recursive_build’:
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c:31028:21: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  31028 |   __pyx_v_idx_array = (&(*((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) ( /* dim=0 */ ((char *) (((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) __pyx_v_self->idx_array.data) + __pyx_t_1)) ))));
        |                     ^
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c: In function ‘__pyx_f_7sklearn_9neighbors_8_kd_tree_12BinaryTree64__query_radius_single’:
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c:38433:21: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  38433 |   __pyx_v_idx_array = (&(*((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) ( /* dim=0 */ ((char *) (((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) __pyx_v_self->idx_array.data) + __pyx_t_2)) ))));
        |                     ^
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c: In function ‘__pyx_f_7sklearn_9neighbors_8_kd_tree_12BinaryTree64__kde_single_breadthfirst’:
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c:38982:21: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  38982 |   __pyx_v_idx_array = (&(*((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) ( /* dim=0 */ ((char *) (((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) __pyx_v_self->idx_array.data) + __pyx_t_2)) ))));
        |                     ^
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c: In function ‘__pyx_f_7sklearn_9neighbors_8_kd_tree_12BinaryTree64__kde_single_depthfirst’:
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c:39887:21: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  39887 |   __pyx_v_idx_array = (&(*((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) ( /* dim=0 */ ((char *) (((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) __pyx_v_self->idx_array.data) + __pyx_t_2)) ))));
        |                     ^
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c: In function ‘__pyx_f_7sklearn_9neighbors_8_kd_tree_12BinaryTree64__two_point_single’:
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c:40497:21: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  40497 |   __pyx_v_idx_array = (&(*((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) ( /* dim=0 */ ((char *) (((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) __pyx_v_self->idx_array.data) + __pyx_t_2)) ))));
        |                     ^
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c: In function ‘__pyx_f_7sklearn_9neighbors_8_kd_tree_12BinaryTree64__two_point_dual’:
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c:40900:22: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  40900 |   __pyx_v_idx_array1 = (&(*((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) ( /* dim=0 */ ((char *) (((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) __pyx_v_self->idx_array.data) + __pyx_t_1)) ))));
        |                      ^
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c:40910:22: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  40910 |   __pyx_v_idx_array2 = (&(*((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) ( /* dim=0 */ ((char *) (((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) __pyx_v_other->idx_array.data) + __pyx_t_1)) ))));
        |                      ^
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c: In function ‘__pyx_f_7sklearn_9neighbors_8_kd_tree_12BinaryTree32__recursive_build’:
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c:44973:21: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  44973 |   __pyx_v_idx_array = (&(*((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) ( /* dim=0 */ ((char *) (((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) __pyx_v_self->idx_array.data) + __pyx_t_1)) ))));
        |                     ^
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c: In function ‘__pyx_f_7sklearn_9neighbors_8_kd_tree_12BinaryTree32__query_radius_single’:
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c:52387:21: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  52387 |   __pyx_v_idx_array = (&(*((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) ( /* dim=0 */ ((char *) (((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) __pyx_v_self->idx_array.data) + __pyx_t_2)) ))));
        |                     ^
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c: In function ‘__pyx_f_7sklearn_9neighbors_8_kd_tree_12BinaryTree32__kde_single_breadthfirst’:
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c:52936:21: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  52936 |   __pyx_v_idx_array = (&(*((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) ( /* dim=0 */ ((char *) (((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) __pyx_v_self->idx_array.data) + __pyx_t_2)) ))));
        |                     ^
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c: In function ‘__pyx_f_7sklearn_9neighbors_8_kd_tree_12BinaryTree32__kde_single_depthfirst’:
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c:53841:21: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  53841 |   __pyx_v_idx_array = (&(*((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) ( /* dim=0 */ ((char *) (((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) __pyx_v_self->idx_array.data) + __pyx_t_2)) ))));
        |                     ^
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c: In function ‘__pyx_f_7sklearn_9neighbors_8_kd_tree_12BinaryTree32__two_point_single’:
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c:54451:21: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  54451 |   __pyx_v_idx_array = (&(*((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) ( /* dim=0 */ ((char *) (((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) __pyx_v_self->idx_array.data) + __pyx_t_2)) ))));
        |                     ^
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c: In function ‘__pyx_f_7sklearn_9neighbors_8_kd_tree_12BinaryTree32__two_point_dual’:
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c:54854:22: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  54854 |   __pyx_v_idx_array1 = (&(*((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) ( /* dim=0 */ ((char *) (((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) __pyx_v_self->idx_array.data) + __pyx_t_1)) ))));
        |                      ^
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c:54864:22: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  54864 |   __pyx_v_idx_array2 = (&(*((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) ( /* dim=0 */ ((char *) (((__pyx_t_7sklearn_5utils_9_typedefs_intp_t const  *) __pyx_v_other->idx_array.data) + __pyx_t_1)) ))));
        |                      ^
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c: In function ‘__pyx_f_7sklearn_9neighbors_8_kd_tree_init_node64’:
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c:56748:24: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  56748 |   __pyx_v_lower_bounds = (&(*((__pyx_t_7sklearn_5utils_9_typedefs_float64_t const  *) ( /* dim=2 */ ((char *) (((__pyx_t_7sklearn_5utils_9_typedefs_float64_t const  *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_tree->node_bounds.data + __pyx_t_1 * __pyx_v_tree->node_bounds.strides[0]) ) + __pyx_t_2 * __pyx_v_tree->node_bounds.strides[1]) )) + __pyx_t_3)) ))));
        |                        ^
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c:56760:24: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  56760 |   __pyx_v_upper_bounds = (&(*((__pyx_t_7sklearn_5utils_9_typedefs_float64_t const  *) ( /* dim=2 */ ((char *) (((__pyx_t_7sklearn_5utils_9_typedefs_float64_t const  *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_tree->node_bounds.data + __pyx_t_3 * __pyx_v_tree->node_bounds.strides[0]) ) + __pyx_t_2 * __pyx_v_tree->node_bounds.strides[1]) )) + __pyx_t_1)) ))));
        |                        ^
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c: In function ‘__pyx_f_7sklearn_9neighbors_8_kd_tree_init_node32’:
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c:58575:24: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  58575 |   __pyx_v_lower_bounds = (&(*((__pyx_t_7sklearn_5utils_9_typedefs_float32_t const  *) ( /* dim=2 */ ((char *) (((__pyx_t_7sklearn_5utils_9_typedefs_float32_t const  *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_tree->node_bounds.data + __pyx_t_1 * __pyx_v_tree->node_bounds.strides[0]) ) + __pyx_t_2 * __pyx_v_tree->node_bounds.strides[1]) )) + __pyx_t_3)) ))));
        |                        ^
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c:58587:24: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  58587 |   __pyx_v_upper_bounds = (&(*((__pyx_t_7sklearn_5utils_9_typedefs_float32_t const  *) ( /* dim=2 */ ((char *) (((__pyx_t_7sklearn_5utils_9_typedefs_float32_t const  *) ( /* dim=1 */ (( /* dim=0 */ (__pyx_v_tree->node_bounds.data + __pyx_t_3 * __pyx_v_tree->node_bounds.strides[0]) ) + __pyx_t_2 * __pyx_v_tree->node_bounds.strides[1]) )) + __pyx_t_1)) ))));
        |                        ^
  during GIMPLE pass: vect
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c: In function ‘__pyx_f_7sklearn_9neighbors_8_kd_tree_min_rdist_dual32’:
  sklearn/neighbors/_kd_tree.cpython-312-aarch64-linux-gnu.so.p/sklearn/neighbors/_kd_tree.pyx.c:59630:67: internal compiler error: in vect_transform_reduction, at tree-vect-loop.cc:7457
  59630 | static CYTHON_INLINE __pyx_t_7sklearn_5utils_9_typedefs_float64_t __pyx_f_7sklearn_9neighbors_8_kd_tree_min_rdist_dual32(struct __pyx_obj_7sklearn_9neighbors_8_kd_tree_BinaryTree32 *__pyx_v_tree1, __pyx_t_7sklearn_5utils_9_typedefs_intp_t __pyx_v_i_node1, struct __pyx_obj_7sklearn_9neighbors_8_kd_tree_BinaryTree32 *__pyx_v_tree2, __pyx_t_7sklearn_5utils_9_typedefs_intp_t __pyx_v_i_node2) {
        |                                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  0x17481f7 internal_error(char const*, ...)
        ???:0
  0x66f88f fancy_abort(char const*, int, char const*)
        ???:0
  0xdc62fb vect_transform_reduction(_loop_vec_info*, _stmt_vec_info*, gimple_stmt_iterator*, gimple**, _slp_tree*)
        ???:0
  0x170dc9f vect_transform_stmt(vec_info*, _stmt_vec_info*, gimple_stmt_iterator*, _slp_tree*, _slp_instance*)
        ???:0
  0xdd3a8f vect_transform_loop(_loop_vec_info*, gimple*)
        ???:0
  Please submit a full bug report, with preprocessed source (by using -freport-bug).
  Please include the complete backtrace with any bug report.
  See <file:///usr/share/doc/gcc-12/README.Bugs> for instructions.
```

### Versions

```shell
1.5.2 and 1.7.0
```

COMMENT:
Hello @n-bes , I came accross the exact same issue.

I found that bumping gcc to a more recent version fixed it.

The environment where I reproduced this issue had gcc 12. It works after upgrading to gcc 14.

Scikit-learn automated release pipelines use [gcc 15](https://github.com/scikit-learn/scikit-learn/blob/main/build_tools/github/pymin_conda_forge_arm_linux-aarch64_conda.lock#L20).

Labels: Bug, Needs Triage