Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

[2.7] Protect climb_stack_and_eval_frame from trivialization #227

Merged
merged 2 commits into from
Aug 23, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions Stackless/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ What's New in Stackless 2.7.XX?

*Release date: XXXX-XX-XX*

- https://github.com/stackless-dev/stackless/issues/227
Protect climb_stack_and_eval_frame from trivialization.
gcc-4.8.5 (and possibly other versions between 4.7 and 5.4) trivializes a
side-effect-only alloca. Patch by Milo Mirate.

- https://github.com/stackless-dev/stackless/issues/220
Improve the error handling in case of failed stack transfers / hard tasklet
switches. Call Py_FatalError, if a clean recovery is impossible.
Expand Down
6 changes: 6 additions & 0 deletions Stackless/core/stacklesseval.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ make_initial_stub(void)
return result;
}

/* a write only variable used to prevent overly optimisation */
intptr_t *global_goobledigoobs;
static PyObject *
climb_stack_and_eval_frame(PyFrameObject *f)
{
Expand All @@ -286,6 +288,10 @@ climb_stack_and_eval_frame(PyFrameObject *f)
goobledigoobs = alloca(needed * sizeof(intptr_t));
if (goobledigoobs == NULL)
return NULL;
/* hinder the compiler to optimise away
goobledigoobs and the alloca call.
This happens with gcc 4.7.x and -O2 */
global_goobledigoobs = goobledigoobs;
}
return slp_eval_frame(f);
}
Expand Down