summaryrefslogtreecommitdiff
path: root/py
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2018-01-02 16:41:34 -0500
committerScott Shawcroft <scott@tannewt.org>2018-01-02 13:41:34 -0800
commitce81c8dda9686d3cd78d9c5383b6982c148ac7ec (patch)
tree4538a243fd60241e753716b1739cd3ce843df4b5 /py
parent3be456629bc737b4d8bfaa27d8ea5e2fd5c86451 (diff)
Avoid gcc 7.2.1 compiler issues in nlr_push() (#506)
Avoid gcc 7.2.1 compiler issues in nlr_push()
Diffstat (limited to 'py')
-rw-r--r--py/nlrthumb.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/py/nlrthumb.c b/py/nlrthumb.c
index 6e7d71766..0616e59b0 100644
--- a/py/nlrthumb.c
+++ b/py/nlrthumb.c
@@ -74,7 +74,13 @@ __attribute__((naked)) unsigned int nlr_push(nlr_buf_t *nlr) {
#else
"b nlr_push_tail \n" // do the rest in C
#endif
- );
+ : // output operands
+ : "r" (nlr) // input operands
+ // Do not use r1, r2, r3 as temporary saving registers.
+ // gcc 7.2.1 started doing this, and r3 got clobbered in nlr_push_tail.
+ // See https://github.com/adafruit/circuitpython/issues/500 for details.
+ : "r1", "r2", "r3" // clobbers
+ );
return 0; // needed to silence compiler warning
}