https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114872

--- Comment #7 from Antonio Rojas <arojas at archlinux dot org> ---
(In reply to Sam James from comment #5)
> Some ideas:
> * Could you maybe give a reproducer for the runtime crash?

In sage, calling any libgap function in exactly 3 parameters triggers this. For
instance:

sage: libgap.AbelianGroup(0,0,0)

Note that you need Python 3.12 to get the crash (which happens when trying to
derefence the null pointer in the newly introduced _Py_IsImmortal function)

> * Any chance you'd be willing to try bisect element.i with pragmas to
> disable/enable optimisation for chunks of it, to find the miscompiled
> function?

I have done that. As expected, the problem is in Py_XDECREF. This makes the
problem disappear:

#pragma GCC push_options
#pragma GCC optimize ("O0")

static inline void Py_XDECREF(PyObject *op)
{
    if (op != 
# 797 "/usr/include/python3.12/object.h" 3 4
             ((void *)0)
# 797 "/usr/include/python3.12/object.h"
                     ) {
        Py_DECREF(((PyObject*)((op))));
    }
}

#pragma GCC pop_options

Reply via email to