Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Python/optimizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,15 @@ executor_traverse(PyObject *o, visitproc visit, void *arg)
return 0;
}

static int
executor_is_gc(PyObject *o)
{
if ((PyObject *)&COLD_EXITS[0] <= o && o < (PyObject *)&COLD_EXITS[UOP_MAX_TRACE_LENGTH]) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The address sanitizer warning here seems plausibly correct:

array subscript 800 is above array bounds of ‘_PyExecutorObject[200]’ [-Warray-bounds]

COLD_EXITS has a length of UOP_MAX_TRACE_LENGTH/4. If there's some other reason this is correct, maybe add a comment / a way to suppress the warning?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, you're right. That line was written by Copilot and it looked so plausible but was so wrong. :-(

return 0;
}
return 1;
}

PyTypeObject _PyUOpExecutor_Type = {
PyVarObject_HEAD_INIT(&PyType_Type, 0)
.tp_name = "uop_executor",
Expand All @@ -405,6 +414,7 @@ PyTypeObject _PyUOpExecutor_Type = {
.tp_methods = executor_methods,
.tp_traverse = executor_traverse,
.tp_clear = executor_clear,
.tp_is_gc = executor_is_gc,
};

/* TO DO -- Generate these tables */
Expand Down