summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMarian Buschsieweke <marian.buschsieweke@ovgu.de>2021-03-30 20:08:11 +0200
committerDamien George <damien@micropython.org>2021-04-14 10:45:26 +1000
commit9c9bfe1968d4260924316353bd1c941fe7e8741d (patch)
tree6574c95b429d3cb51a6db3cd5e6d270759757bae
parent2ac09c2694f89b11544f4abf10413c64eeec2b15 (diff)
downloadmicropython-9c9bfe1968d4260924316353bd1c941fe7e8741d.tar.gz
micropython-9c9bfe1968d4260924316353bd1c941fe7e8741d.zip
unix/main: Make static variable that's potentially clobbered by longjmp.
This fixes `error: variable 'subpkg_tried' might be clobbered by 'longjmp' or 'vfork' [-Werror=clobbered]` when compiling on ppc64le and aarch64 (and possibly other architectures/toolchains).
-rw-r--r--ports/unix/main.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ports/unix/main.c b/ports/unix/main.c
index 129c6d3bb4..e33c1742d8 100644
--- a/ports/unix/main.c
+++ b/ports/unix/main.c
@@ -596,7 +596,12 @@ MP_NOINLINE int main_(int argc, char **argv) {
mp_obj_t mod;
nlr_buf_t nlr;
- bool subpkg_tried = false;
+
+ // Allocating subpkg_tried on the stack can lead to compiler warnings about this
+ // variable being clobbered when nlr is implemented using setjmp/longjmp. Its
+ // value must be preserved across calls to setjmp/longjmp.
+ static bool subpkg_tried;
+ subpkg_tried = false;
reimport:
if (nlr_push(&nlr) == 0) {