#10845·numba

在 nopython 模式下,对带符号的整数数组调用 `np.remainder` / `np.mod` / `np.divmod` 会导致进程崩溃 (NumPy 返回 0); `np.floor_divide(MIN_INT, -1)` 返回 0,而不是 `MIN_INT`。

作者: cuiliaomei-beep创建于 2026年9月21日更新于 2026年9月22日
标签bug - segfault

**Summary.** For signed integer arrays that contain the pair `(iinfo(dtype).min, -1)`, NumPy's `np.remainder`, `np.mod`, and `np.divmod` return `0`, while the same ufuncs inside an `@njit` function terminate the interpreter: there is no Python exception, the process exits with status `0xC0000095` (integer overflow) on Windows and is killed by `SIGFPE`, the hardware trap of `idiv`, on Linux (Numba 0.67.0). A single such element in the data takes down the whole process, a server or a notebook kernel included, and `try/except` cannot catch it. Because the Python operator `%` and `np.floor_divide` inside the same jitted function return `0`, only the ufunc remainder path lacks the guard for this operand pair, and all four signed dtypes, int8 and int16 included, are affected.