-
-
Notifications
You must be signed in to change notification settings - Fork 12.2k
BUG: matmul.at segfaults #21301
Copy link
Copy link
Closed
Labels
00 - BugsprintableIssue fits the time-frame and setting of a sprintIssue fits the time-frame and setting of a sprint
Description
Describe the issue:
Calling matmul.at on arrays that pass all checks on shape, indices, etc, leads to a segmentation fault.
Expected result
Calling other methods of ufuncs with a non-trivial signature raises either a RuntimeError: Reduction not defined on ufunc with signature or, in the case of outer, a TypeError: method outer is not allowed in ufunc with non-trivial signature. Because at is not a reduction, my expectation is getting a TypeError: method at is not allowed in ufunc with non-trivial signature. I took the liberty to make the tiny adaption that implements the expected behavior here: dbeutel@6db8d96
Reproduce the code example:
import numpy as np
arr = np.ones((2, 2, 2))
np.matmul.at(arr, [0], np.ones((1, 2, 2)))Error message:
$ gdb --args python-dbg segfault_matmul_at.py
GNU gdb (GDB) 11.2
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python-dbg...
(gdb) run
Starting program: /usr/bin/python-dbg segfault_matmul_at.py
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7ffff45ff640 (LWP 5504)]
[New Thread 0x7ffff3dfe640 (LWP 5505)]
[New Thread 0x7ffff15fd640 (LWP 5506)]
[New Thread 0x7fffecdfc640 (LWP 5507)]
[New Thread 0x7fffea5fb640 (LWP 5508)]
[New Thread 0x7fffe7dfa640 (LWP 5509)]
[New Thread 0x7fffe55f9640 (LWP 5510)]
Thread 1 "python-dbg" received signal SIGSEGV, Segmentation fault.
0x00007ffff707fb00 in DOUBLE_matmul () from /home/dbeutel/.local/lib/python3.10/site-packages/numpy/core/_multiarray_umath.cpython-310-x86_64-linux-gnu.so
(gdb) bt
#0 0x00007ffff707fb00 in DOUBLE_matmul () from /home/dbeutel/.local/lib/python3.10/site-packages/numpy/core/_multiarray_umath.cpython-310-x86_64-linux-gnu.so
#1 0x00007ffff70842e5 in generic_wrapped_legacy_loop () from /home/dbeutel/.local/lib/python3.10/site-packages/numpy/core/_multiarray_umath.cpython-310-x86_64-linux-gnu.so
#2 0x00007ffff7087548 in ufunc_at () from /home/dbeutel/.local/lib/python3.10/site-packages/numpy/core/_multiarray_umath.cpython-310-x86_64-linux-gnu.so
#3 0x00007ffff7cfa81e in method_vectorcall_VARARGS (func=func@entry=0x7ffff7330dd0, args=args@entry=0x5555555f86d8, nargsf=<optimized out>, kwnames=0x0) at Objects/descrobject.c:311
#4 0x00007ffff7d08f4b in _PyObject_VectorcallTstate (kwnames=<optimized out>, nargsf=<optimized out>, args=<optimized out>, callable=<optimized out>, tstate=<optimized out>) at ./Include/cpython/abstract.h:114
#5 PyObject_Vectorcall (kwnames=<optimized out>, nargsf=<optimized out>, args=<optimized out>, callable=<optimized out>) at ./Include/cpython/abstract.h:123
#6 call_function (tstate=0x55555555e7a0, trace_info=<optimized out>, pp_stack=0x7fffffffe1f0, oparg=<optimized out>, kwnames=<optimized out>) at Python/ceval.c:5867
#7 0x00007ffff7cfec4e in _PyEval_EvalFrameDefault (tstate=<optimized out>, f=0x5555555f8570, throwflag=<optimized out>) at Python/ceval.c:4198
#8 0x00007ffff7cfd2eb in _PyEval_EvalFrame (throwflag=0, f=0x5555555f8570, tstate=0x55555555e7a0) at ./Include/internal/pycore_ceval.h:46
#9 _PyEval_Vector (tstate=<optimized out>, con=<optimized out>, locals=<optimized out>, args=<optimized out>, argcount=0, kwnames=<optimized out>) at Python/ceval.c:5065
#10 0x00007ffff7d7a1b4 in PyEval_EvalCode (co=0x7ffff739f780, globals=0x7ffff73c15b0, locals=<optimized out>) at Python/ceval.c:1134
#11 0x00007ffff7d948b4 in run_eval_code_obj (tstate=0x55555555e7a0, co=0x7ffff739f780, globals=0x7ffff73c15b0, locals=0x7ffff73c15b0) at Python/pythonrun.c:1291
#12 0x00007ffff7d8c316 in run_mod (mod=<optimized out>, filename=<optimized out>, globals=0x7ffff73c15b0, locals=0x7ffff73c15b0, flags=<optimized out>, arena=<optimized out>) at Python/pythonrun.c:1312
#13 0x00007ffff7c4024f in pyrun_file (fp=fp@entry=0x55555555a4f0, filename=filename@entry=0x7ffff73dc0b0, start=start@entry=257, globals=globals@entry=0x7ffff73c15b0, locals=locals@entry=0x7ffff73c15b0, closeit=closeit@entry=1, flags=0x7fffffffe5c8) at Python/pythonrun.c:1208
#14 0x00007ffff7c3f9fc in _PyRun_SimpleFileObject (fp=0x55555555a4f0, filename=0x7ffff73dc0b0, closeit=1, flags=0x7fffffffe5c8) at Python/pythonrun.c:456
#15 0x00007ffff7c40b2b in _PyRun_AnyFileObject (fp=0x55555555a4f0, filename=0x7ffff73dc0b0, closeit=1, flags=0x7fffffffe5c8) at Python/pythonrun.c:90
#16 0x00007ffff7da4e9c in pymain_run_file_obj (skip_source_first_line=0, filename=0x7ffff73dc0b0, program_name=0x7ffff73c1960) at Modules/main.c:353
#17 pymain_run_file (config=0x555555585550) at Modules/main.c:372
#18 pymain_run_python (exitcode=0x7fffffffe5c4) at Modules/main.c:587
#19 Py_RunMain () at Modules/main.c:666
#20 0x00007ffff7d67efd in Py_BytesMain (argc=<optimized out>, argv=<optimized out>) at Modules/main.c:720
#21 0x00007ffff7999310 in __libc_start_call_main () from /usr/lib/libc.so.6
#22 0x00007ffff79993c1 in __libc_start_main_impl () from /usr/lib/libc.so.6
#23 0x0000555555555045 in _start ()NumPy/Python version information:
- numpy: 1.22.3
- python: 3.10.2 (main, Apr 5 2022, 14:03:41) [GCC 11.2.0]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
00 - BugsprintableIssue fits the time-frame and setting of a sprintIssue fits the time-frame and setting of a sprint