summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 129c6d3bb..e33c1742d 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) {