Closed as duplicate of#28843
Description
Describe the issue:
The following program crashes under NumPy 2.2.5 on a GCP t2a VM (ARM), on both 3.13.2 and 3.13.2t.
Reproduce the code example:
import numpy as np
x = np.random.randn(200, 200) + np.random.randn(200, 200) * 1j
x @ np.conj(x.T)
Error message:
$ python t.py
free(): invalid pointer
Aborted (core dumped)
GDB backtrace:
(gdb) bt
#0 __pthread_kill_implementation (threadid=257665711177760, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
#1 0x0000ea5877b77670 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2 0x0000ea5877b2cb3c in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#3 0x0000ea5877b17e00 in __GI_abort () at ./stdlib/abort.c:79
#4 0x0000ea5877b6abf4 in __libc_message_impl (fmt=fmt@entry=0xea5877c54b00 "%s\n") at ../sysdeps/posix/libc_fatal.c:134
#5 0x0000ea5877b8210c in malloc_printerr (str=str@entry=0xea5877c4ff38 "free(): invalid pointer") at ./malloc/malloc.c:5772
#6 0x0000ea5877b844cc in _int_free (av=0xea5877ca0a50 <main_arena>, p=p@entry=0xc20ecfb2fe80, have_lock=have_lock@entry=0) at ./malloc/malloc.c:4507
#7 0x0000ea5877b86f88 in __GI___libc_free (mem=<optimized out>) at ./malloc/malloc.c:3398
#8 0x0000ea5874f2d2a4 in gemm_driver.isra () from /home/phawkins_google_com/myenv/lib/python3.13t/site-packages/numpy/_core/../../numpy.libs/libscipy_openblas64_-48fd33d4.so
#9 0x0000ea5874f2d3dc in cgemm_thread_nn () from /home/phawkins_google_com/myenv/lib/python3.13t/site-packages/numpy/_core/../../numpy.libs/libscipy_openblas64_-48fd33d4.so
#10 0x0000ea5874e305b4 in scipy_cblas_cgemm64_ () from /home/phawkins_google_com/myenv/lib/python3.13t/site-packages/numpy/_core/../../numpy.libs/libscipy_openblas64_-48fd33d4.so
#11 0x0000ea58763d0010 in CFLOAT_matmul_matrixmatrix () from /home/phawkins_google_com/myenv/lib/python3.13t/site-packages/numpy/_core/_multiarray_umath.cpython-313t-aarch64-linux-gnu.so
#12 0x0000ea58763d34d8 in CFLOAT_matmul () from /home/phawkins_google_com/myenv/lib/python3.13t/site-packages/numpy/_core/_multiarray_umath.cpython-313t-aarch64-linux-gnu.so
#13 0x0000ea587653ac6c in generic_wrapped_legacy_loop () from /home/phawkins_google_com/myenv/lib/python3.13t/site-packages/numpy/_core/_multiarray_umath.cpython-313t-aarch64-linux-gnu.so
#14 0x0000ea5876541070 in PyUFunc_GeneralizedFunctionInternal () from /home/phawkins_google_com/myenv/lib/python3.13t/site-packages/numpy/_core/_multiarray_umath.cpython-313t-aarch64-linux-gnu.so
#15 0x0000ea5876548800 in ufunc_generic_fastcall () from /home/phawkins_google_com/myenv/lib/python3.13t/site-packages/numpy/_core/_multiarray_umath.cpython-313t-aarch64-linux-gnu.so
#16 0x0000ea58780a21d8 in _PyObject_VectorcallTstate (tstate=0xea5879241330 <_PyRuntime+310512>, callable=0x4c40dee8100, args=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at ./Include/internal/pycore_call.h:168
#17 0x0000ea5877fdeffc in _PyEval_EvalFrameDefault (tstate=0xea5879241330 <_PyRuntime+310512>, frame=0xea58792ff238, throwflag=<optimized out>) at Python/generated_cases.c.h:813
#18 0x0000ea58780a21d8 in _PyObject_VectorcallTstate (tstate=0xea5879241330 <_PyRuntime+310512>, callable=0x4c4100d8520, args=<optimized out>, nargsf=<optimized out>, kwnames=<optimized out>) at ./Include/internal/pycore_call.h:168
#19 0x0000ea58780a2390 in method_vectorcall (method=<optimized out>, args=0x4c40a0ada38, nargsf=<optimized out>, kwnames=0x4c412b80390) at Objects/classobject.c:62
#20 0x0000ea5878044730 in _PyVectorcall_Call (kwargs=0xea58780a2200 <method_vectorcall>, tuple=0x4c40a0ada38, callable=0x4c412f66b00, func=0xea58780a2200 <method_vectorcall>, tstate=0xea5879241330 <_PyRuntime+310512>)
at Objects/call.c:285
Python and NumPy Versions:
2.2.5
3.13.2 experimental free-threading build (main, Mar 17 2025, 20:49:10) [GCC 6.3.0 20170516]
Runtime Environment:
[{'numpy_version': '2.2.5',
'python': '3.13.2 experimental free-threading build (main, Mar 17 2025, '
'20:49:10) [GCC 6.3.0 20170516]',
'uname': uname_result(system='Linux', node='phawkins-t4a.us-central1-f.<redacted>', release='6.11.0-1013-gcp', version='#13~24.04.1-Ubuntu SMP Wed Apr 2 16:07:02 UTC 2025', machine='aarch64')},
{'simd_extensions': {'baseline': ['NEON', 'NEON_FP16', 'NEON_VFPV4', 'ASIMD'],
'found': ['ASIMDHP'],
'not_found': ['ASIMDFHM', 'SVE']}},
{'architecture': 'neoversen1',
'filepath': '/home/<redacted>/myenv/lib/python3.13t/site-packages/numpy.libs/libscipy_openblas64_-48fd33d4.so',
'internal_api': 'openblas',
'num_threads': 48,
'prefix': 'libscipy_openblas',
'threading_layer': 'pthreads',
'user_api': 'blas',
'version': '0.3.28'}]
Context for the issue:
Crashes on the stable branch (and found to crash in JAX CI).